I accidentially unzipped an archive to the root of a disk instead of to a folder.

How can I remove all 188 files without doing it manually?

I now also have unzipped the files in the folder I want, so basically I need to remove all files in c:/dropbox which are also in c:/dropbox/myfolder, but recursively.

I'm on windows 10, but have also installed linux subsystem for windows, so it can be an unix-command too.


I did

cd dropbox/myfolder
find . -type f -ok rm ../{} \;
find . -depth -type f -ok rmdir ../{} \;

I used -ok instead of -exex to be safe. I did the find in two steps, so I wouldn't delete folders existing in the zip, but also existing already; folders with files remaining after the wrongly unzipped files removed shouldn't be deleted.

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.