I have gone through couple of previously answered questions but couldn't find any thing which will work for me.

I used this command accidently on a wrong folder, which deleted some important files and scripts except *.sh files.

 find . -type f ! -name '*.sh' -delete

Is it possible to recover the files ?

  • You might try with testdisk from a live Linux DVD but success is not guaranteed at all. – Andrea Lazzarotto Sep 18 '16 at 21:27

If you have TimeMachine enabled then you can restore via the normal TimeMachine UI.

If you don't have TimeMachine enabled you may be able to use local snapshots to recover via the normal TimeMachine UI.

You can install photoreq from testdisk to look in the raw disk for script files, this is likely to turn up a lot of false positives.

Testdisk (inc Photoreq) downloads: http://www.cgsecurity.org/wiki/TestDisk_Download

Finally you should use this as warning and setup TimeMachine if you have not already, while it's not perfect it is far better than nothing.

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.