I have to unpack a tar.gz file after moving it to a folder. While moving it to destination folder, I unexpectedly tried to move it to ] named folder and gave Ctrl+C . Now half of the files are in tar.gz and half in ].

Then I tried to move ] into tar.gz and it was moved.

Now when I try to unpack the file it is showing unexpected end of file error.

Is there any way to bring back the ] from tar.gz and make the exact tar.gz file and unzip the same.

Thanks in advance.


No, that's not how mv works.

I'm assuming that you are talking about a single file that you accidentally moved to the wrong name on another filesystem (and interrupted the transfer half-way through), and then moved the wrongly named file back to its original location and name.

If the file moves within the same filesystem, the move is pretty much instantaneous (it's just a renaming of the file and does not even touch the file's content).

If the file is moved to a new filesystem, then the file contents is copied, then the original is deleted.

If you moved the file between filesystems and interrupted the process, the original would still have been intact. But since you now have overwritten the original with the partial copy, the original is unfortunately lost.

Restore from backup, if you have one.

See also: Can overwritten files be recovered?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.