-1

I ran into an issue where I had to restart my computer during a large extraction process involving many zip files :(.

All the zip files contain a folder that has the name of the zip file (minus .zip)

Most of the files extracted but still many more to go.

I need to know how I could list ONLY THE MATCHING FILES AND FOLDERS and hide (or move) them to a sub folder. I thought hiding would be easier for me, but which ever is easier for you since you are the coder.

Also, when I restarted the system, I don't recall the last file that was extracting, so if that also has a folder, I need to find that file/folder and just delete the folder so I can re extract it

end result after running a bash script or terminal command, I should see ONLY the zip files without a matching folder so I can extract them.

The incomplete extracted folder should be deleted, or listed so I know which one it was, so I can delete it.

1
  • 4
    It will be faster to backup the ZIP file, delete all the partial extractions, restart and extract again.
    – anon
    Commented Jun 2 at 23:01

1 Answer 1

0

This will spit out .zip files in the current directory that don't have a matching file/directory name:

ls | sed 's/.zip$//g' | sort | uniq -u | sed 's/$/.zip/g'

(To get only the files that DO match, change the -u to -d after uniq)

As for getting the extraction that didn't complete, that's harder to truly confirm without just inspecting each .zip's contents. But, if you extracted one-at-a-time, and if you know that nothing has been modified since you did the extractions, you can just sort them by modified time. The newest directory should be the one it was in the middle of extracting.

This will list all files/directories sorted by the time they were last modified, with the newest at the bottom:

ls -latr

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .