Search code examples
linuxbinaryfilestar

Binary File from script after Tar Issue


I was copying a folder from a Debian computer (university specific distro) to a Windows computer. I used tar to make a gunzipped tarball containing the folder. I transferred the file using MobaXterm, which used SFTP. I accidentally removed the original file, but I still had the tarball, so I used that to restore.

However, when I looked back in the directory to edit the file heatmap_get.py (which was marked executable), it was a bunch of unreadable information. When I tried to execute the script, it stated:

-bash: ./heatmap_gen.py: cannot execute binary file

I have tried executing strings on the file, but it is not helpful. This tarball contained multiple files, but this was the only one that was effected. I really need this file; any help is appreciated.

Update:

If I copied heatmap_gen.py to heatmap_gen.tar.gz, and undid the tarball, it yielded an exact copy of the directory it was in except it did not have the heatmap_gen.py file.


Solution

  • It looks like the original tarball was not archived correctly as pointed out by l'L'l. It appears that the tarball contained a copy of itself within the file heatmap_gen.py.