So I wanted to clean a directory and subdirectories from non .doc|.docx files and I ran the following command:
rm -rf /home/user/dir/dir1/dir11/ !(*.doc|*.docx)
and I just deleted my home directory (hundreds of thousands of files...). My last save is not so recent. It's not the end of the world but it would help a lot if I could recover it. So my questions are:
1) why did it go wrong?
2) can I recover the deleted directories and files? Obviously they're not in the Trash. Would testdisk or photorec help?
Thanks for the help!
rm -f !(/var/www/wp)
leave files behind in /var/www? – Michael Homer Dec 28 '16 at 08:27