Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Recover Accidentally Deleted Files in OS X via Terminal, "command not found"

Hi!


I am trying to recover a folder from the trash. It was deleted 30 min ago. The command I am trying to use is;


Mys-MacBook-Pro:~ storedisk$ com.apple.Finder AppleShowAllFiles true


And the response is;


-bash: com.apple.Finder: command not found


When I open any Terminal window I get this message, I don't know if this is relevant;


Last login: Wed Nov 13 08:27:40 on ttys001


I have found some similar replies on the forum but they do not seem to work in my case. I'm new to Terminal so I would really appreciate the help to find the cause and to resolve my problem.


Thanks a lot!

MacBook Pro, Mac OS X (10.7.5)

Posted on Nov 13, 2013 7:16 AM

Reply
Question marked as Best reply

Posted on Nov 13, 2013 8:21 AM

You command is wrong.


In the Terminal run the following command which will show all (-a) files in your Trash. If however, you compulsively emptied your Trash (as I tend to do), your file(s) are gone. That is the (ell)s command below.

Mys-MacBook-Pro:~ storedisk$ ls -a .Trash


If you file is in the Trash, you can retrieve it:

Mys-MacBook-Pro:~ storedisk$ mv .Trash/filename .


The following syntax will show all files. You would supply FALSE to not show all files. The values of true or 1 and false or 0 will also work.


Mys-MacBook-Pro:~ storedisk$ defaults write com.apple.finder AppleShowAllFiles -bool TRUE
11 replies
Question marked as Best reply

Nov 13, 2013 8:21 AM in response to minaemelia

You command is wrong.


In the Terminal run the following command which will show all (-a) files in your Trash. If however, you compulsively emptied your Trash (as I tend to do), your file(s) are gone. That is the (ell)s command below.

Mys-MacBook-Pro:~ storedisk$ ls -a .Trash


If you file is in the Trash, you can retrieve it:

Mys-MacBook-Pro:~ storedisk$ mv .Trash/filename .


The following syntax will show all files. You would supply FALSE to not show all files. The values of true or 1 and false or 0 will also work.


Mys-MacBook-Pro:~ storedisk$ defaults write com.apple.finder AppleShowAllFiles -bool TRUE

Nov 13, 2013 8:34 AM in response to VikingOSX

Thank you so much. This is the reply that I got;

Mys-MacBook-Pro:~ storedisk$ ls -a .Trash

. Cherry Blossoms

.. FLiCKS

.DS_Store Nicholas Nickleby (1977)

13 Tzameti Robin Hood (2010)

Catch-22 [1970] We Live in Public 2009

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS .

Mys-MacBook-Pro:~ storedisk$

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS

usage: mv [-f | -i | -n] [-v] source target

mv [-f | -i | -n] [-v] source ... directory


It is the FLiCKS folder that I am trying to retreive. Does this mean that I can retreive it? And if so, when I use the command mv .Trash/filename, where should it appear? Sorry for not fully understanding the instructions.

I also tend to empty the trash cumpulsively, which is how this happened in the first place. Trying to empty the files already in the trash but accidentally having had this folder selected I emptied that and kept the files that I didn't want.
The trash folder still has the size as if the folder FLiCKS is still in there though, if that makes any difference?

Thank you for all of your help.

Nov 13, 2013 9:30 AM in response to VikingOSX

The response is;

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS .

mv: .Trash/FLiCKS: No such file or directory

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS ~

mv: .Trash/FLiCKS: No such file or directory

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS $HOME

mv: .Trash/FLiCKS: No such file or directory


Would that mean that it is gone?



This is the article that I was using to try in the first place;
http://www.wikihow.com/Recover-Accidentally-Deleted-Files-in-OS-X

Nov 13, 2013 9:41 AM in response to minaemelia

The command sequence:

Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS .


would have moved the FLiCKS folder out of the Trash and put it in the following location:


Mys-MacBook-Pro:~ storedisk$


If you do the following, the FLiCKS folder should appear. The vertical bar is a pipe symbol that takes the output from ls and feeds it to the grep utility, that in this case, will list the folder FLiCKS if it is in this directory location (to the left). If you did the ls -al on the FLiCKS folder itself, it would list its folder contents.


Mys-MacBook-Pro:~ storedisk$ ls -al | grep FLiCKS

Feb 27, 2014 4:31 AM in response to VikingOSX

Hi

I'm having a similar problem.

I was rearranging somethings on my external hardrive and relocating them onto my desktop.

From the desktop I accidently deleted three folders into the trash and emptied it.

This happened last night.


Is there any way I can retrieve them or undo the "empty trash" function via Terminal?


There are tons of data recovery programs however, they recover files and do not present the files again in the folder format they were originally in prior to deletion.


Any input you have would be greatly appreciated!

Thank you.

Feb 27, 2014 6:15 AM in response to k1328230

Once you empty the Trash, the files are gone. If there were any competent data recovery applications for OS X, by the time you decided to purchase, and learn how to effectively use them, any ability to recover the lost data would be close to impossible as the original file bytes have been overwritten or reallocated for other storage.


It does underscore the need for a consistent backup methodology (e.g. Time Machine).

Jul 3, 2014 4:34 AM in response to VikingOSX

Yes,
If you did not empty the Trash, click on the Trash icon at the right side of the Dockand drag those files to a different location.


If you emptied the Trash, it is more difficult. Typically, when a file is erase, it is not really erased. The space the file occupied become unallocated, so that new data can be written over that space. If new data files have not yet been written over that space, the old data is still there and may be recoverable.


There are utilities specifically for data recovery. For example (I have not used)


http://www.prosofteng.com/products/data_rescue.php


Other more general utilities, such as TechTool Pro by Micromat, have a data recovery "module" as part of the package. I have this utility (and it's a good product), but I have never used it for doing data recovery.


You may be able to use such tools to recover erased data. If you intend to try, you should use the disk that held the erased data as little as possible, to reduce the likelihood that new data files will be written over the space used by the old data.

Jul 20, 2015 2:00 AM in response to minaemelia

I accidentally emptied my Mac trash bin a few days ago and I tried many methods on Google, but none of them worked. And then I tried to download data recovery programs which are suggested by my friend and choose one of them. It can scan for my lost files and get them back to me. You can have a try on it. http://www.uflysoft.com/data-recovery-mac/

Recover Accidentally Deleted Files in OS X via Terminal, "command not found"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.