Sample Header Ad - 728x90

Recover mis-gzipped folder / directory & files

1 vote
1 answer
66 views
I needed to compress/archive a folder, so I ran the following command:
gzip -v --rsyncable --fast -r myFolder/ -c > myFolderArchive.gz
...foolishly thinking this was going to do just what I thought it would: an archive of myFolderArchive and its files recursively. It even had a nice output:
./myFolder/file1 ... 80%
./myFolder/file2 ... 20%
...
Opening the archive later however, I only see a single file in it. A quick search led me to understand my mistake: GZip (or I guess, myself) has taken every file, compressed it, and concatenated them one by one into a single file, essentially. Losing all file/directory structure. In the meantime, I've rm -r'd the original folder. All I have now is myFolderArchive.gz. Would anyone see a way to take that archive, and potentially reconstruct the original set of files, from the myFolderArchive.gz file's content, now that it's all mixed into a single GZipped file? I do still have access to the original disk (for a limited time) and could potentially attempt to recover at least the original directory structure (filesystem is ext4). Technically, the content/data itself is in myFolderArchive.gz, it would "just" need to be sliced right...
Asked by Undo (113 rep)
Dec 22, 2024, 04:32 AM
Last activity: Dec 23, 2024, 05:59 AM