What is file name extension .done? - file

What is the file name extension ".done"?
How to handle the files with this extension? For example filename.log.gz.done is file name, can we just remove the done extension and use it?
What is the use of this file extension?

".done" is just a marker that signifies that the file is ready for consumption.
So yes, get rid of the done extension and use it.
More details can be found here: http://www.davsclaus.com/2010/12/camel-26-using-done-files-with-fileftp.html

The ".done" file extension may be appended onto any type of file, such as a .TXT or .LOG file, and may be found on an FTP server where multiple have access to the file. The DONE file helps prevents a user from accessing a file that is not meant to be accessed. The ".done" extension should be removed in order to open the actual file.
This takes you to the source from which I'm quoting my answer from. You will see a clear explanation of .done file extension and it's also a great reference for any other file extensions that you might need information about

Related

how to get the type of the file before its compression

For example, if we have the following file: file.txt that after the compression is now file.new (new is the new extension) , how to obtain that .txt extension, that is forgotten?
I need that to decompress the file.
In general, if you lose the file name extension you can't get it back. It's as simple as this.
However, there might be chances depending on the compression format. Some formats do store the original file name (along with other informations) in the compressed file. And the "decompressor" will be able to recreate those properties.
Anyway, it's good practise to name a compressed file with an additional extension, in your case file.txt.new.
Oh, and you don't need to know the file name extension to uncompress the compressed file. Just uncompress it and give it a temporary name. As #MarcoBonelli said, file contents and file name extensions have no fixed relation. They are just a convention to handle them conveniently.
For example: You can rename a EXE to DOCX. Windows will show the Word icon but it is still an executable. Windows will not attempt to run it, though.
To know what a file contains can be difficult. The magic number Marco linked to might give you some hint.

Reconstruct odt file with missing content.xml file

I have an .odt file that's corrupt. I looked online and apparently if you can get to the content.xml file, there's a chance the file can be repaired. However, in my case, when I convert the file to a .zip and extract it, I don't have that file. However, the .odt file is 2.9MB and has content in it when you convert it to a .txt file.
How can I recreate the content.xml file from the .txt file?
You might not want to hear this, but depending on where the corruption happened, there is nothing you can do.
The idea behind the method you are describing is that if the corruption only concerns, for example, the styles.xml, you can still recover the contents by looking at content.xml. For more details on this, see https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Format_internals
However, from your zip extract, it looks like the only uncorrupted file is styles.xml, which doesn't help you much.
What you can try to do is the following: Rename your .odt-File so that it ends in .zip, and then try to recover that file using one of the multitude of tools available on the internet, for example here, until you get a valid content.xml file.

Huffman compressed files with my own extension

I am working on a project that uses Huffman algorithm to compress files, and I am doing my project using Java, what I want is to create my own file extension say (.huff) for the compressed file, and when I right click a file if it has the (.huff) extension, I want to add a new option which decompresses it, I searched the web but I did not find anything useful.
Any help would be appreciated.
To set the file extension just use one of the String methods like append(".yourExtension") (append it to the filename) and set as filename. Simple as that.
String filename = filename.append(extension);
To decompress the compressed file, I suggest you write a metod to which you provide a path to file as argument, check if the file extension is correct and then in another method you decompress this file.
There is nothing special about a file extension, it's just a part of the file name. To create a .huff file extension, just add .huff to the end of the file name.
To add the windows context menu, that's explained in the question linked in the comments How can I add a context menu to the Windows Explorer for a Java application?
I would recommend creating a batch script that will launch your program taking in the file to decompress as an argument.
Something similar to:
#echo off
java -cp <path-to-jar> <decompression main class> %1
Adding in any other setup or program arguments you need. Then a registry entry might look like.
HKEY_CLASSES_ROOT\.huff\shell\Decompress huffman encoded file\command
"<path to batch file>" "%1"

cmd- Copying file content into specific lines of an existing file

I'm trying to make an batch file that will copy the contents of a .cfg file into another .cfg file. The problem I'm having is that I want the contents of the first file to be placed at specific lines of the destination file, for example, placing the contents between line 300 and 343 and overwriting the original content within those lines.
Any way of doing this?
If there isn't a way to detect specific lines maybe there is a way to detect a specific string, like an ID?
If you are allowed to use 3rd party tools in your environment you can use a regex CLI tool to find and then replace the lines / values you need. The tool can be called using batch scripts.
Example Tools from another question:
https://superuser.com/questions/339118/regex-replace-from-command-line

Loading files into MAGMA

I'm trying to load files into MAGMA and am running into some trouble. Ostensibly, the command load "filename";should be sufficient. I've attempted, but keep getting the same result:
>> load "filename";
^
User error: Could not open file "filename" (No such file or directory)
The file is saved in my documents folder, so I'm not sure what the issue is. Do I have to specify the path? Save the file in a particular place?
I've tried reformatting, using both txt and rtf files, so I don't think that's the issue.
For loading file in MAGMA you can place your file in installed place folder. For example: C:\Program Files (x86)\Magma
Also if your file have an special format you should mention it.
Suppose You want loading a txt file with name a. with load"a"; you face with error. You must type load"a.txt";.
Try using GetCurrentDirectory() command to find your current directory location. And then you can use SetPath() to change where MAGMA has to be to search for your file. This will fix it.

Resources