I can put back the items one by one, but there are too many files, how could I restore all the files in the trash?
Macos – How to restore all the files from trash in Mac OS X
macosrestoretrash
macosrestoretrash
I can put back the items one by one, but there are too many files, how could I restore all the files in the trash?
Best Answer
MacOS keeps file meta information about deleted files in
~/.Trash/.DS_Store
, which also contains records of the original locations. I've written a perl script that scans~/.Trash/.DS_Store
file and prints commands to move all files back to their original location. The output can be fed directly to shell.Perl script: https://gist.github.com/cpq/3d58e144a3fc2e47c54a
To run, download script, start terminal and type
perl restore_mac_trash.pl