1

I was compressing a rosbag file using tar when I mistakenly used the same original file name for the the archive name and had it overwritten by the output archive , the compressed archive size is very small compared to the expected output had I used another name e.g., file.tar.xz. When I extract the archive , I get a file of type "STL 3D model (binary) (model/x.stl-binary)" instead of the original bag file of type "Binary (application/octet-stream)". The file size is the same but the format is different.

Is there a way to retrieve the original file or is this irreversible ? kindly find below the commands used to compress then extract the file.

tar -cJf <file.bag> <file.bag>
tar -xf <file.bag>

any help would be much appreciated , thanks in advance.

Amr
  • 11
  • 1
    firstly, the file is probably gone, depending on your system, but if it is a default Ubuntu install it won't have snapshots turned on. secondly, you may find that the file type is different, depending on the source of the object. application/octet-stream is often used as a generic object type, or used by lazy systems to identify binary objects. it could be that your object always was a model/x.stl-binary – Jad May 20 '21 at 11:10
  • Depending on how the file was stored on the drive, you could try some file recovery software; i.e, If there were multiple instances of the data that was in the file written to the disk. Testdisk is a free one that works well. – Shōgun8 May 20 '21 at 11:40
  • See this post: https://unix.stackexchange.com/questions/149342/can-overwritten-files-be-recovered – Shōgun8 May 20 '21 at 11:44

0 Answers0