Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

My wife saw the folder 'all documents' in Finder and decided to move it all to the trash.

Now we have over 9,000 files in the trash and I haven't been able to find a way to put back everything with one click.

For some reason it will only let me 'put back' one file at a time.

Is there any way to automate this?

share|improve this question
    
If she dragged the folder into the trash, then just drag it back out? –  henryaaron Jan 25 '12 at 5:58

7 Answers 7

up vote 6 down vote accepted

If "Put Back" is disabled for a multiple-item selection it means that (at least) one of the items selected doesn't have its original location information stored in the Trash directory's .DS_Store file.

Though it's less than ideal, try multi-selecting subsets of the files looking for groups that you can "Put Back" en masse before resorting to manual filing for the remaining files.

share|improve this answer
    
I can't seem to "Put Back" files en masse. I can select either file and the option to put back is there but when I select both "Put Back" is not available. Thus I don't think you can "Put Back" en masse. Maybe with an applescript though... –  Steve Moser Feb 3 '13 at 16:12

Try running a script like this in AppleScript Editor:

repeat
    tell application "Finder"
        close windows
        if items of trash is {} then return
        open trash
        activate
    end tell
    tell application "System Events"
        key code 125 -- down arrow
        key code 51 using command down -- command-delete
    end tell
end repeat

If Finder shows a password dialog when you try to put back some item, try adding something like this to the end of the tell application "System Events" block:

delay 1
if exists window 1 of process "SecurityAgent" then
    tell window 1 of process "SecurityAgent"
        set value of text field 2 of scroll area 1 of group 1 to "pa55word"
        click button 2 of group 2
    end tell
end if
delay 1
share|improve this answer

you should be able to highlight every file or at least do it in incremental batches, copy them then re-paste them I believe. I just tried it and if you double click your trash can then right click the files you wish to restore there is a "put back" option which only works file by file, as said i would highlight then press C-c (command c)to copy then C-v(command v) to paste them back.

share|improve this answer

This worked for me:

  • Create a new folder in Finder, I called mine "recovered files"
  • Open Trash folder and select a group of files
  • Copy files and paste into "recovered files" folder.

If you need to put back a large folder, or a large number of individual files, use this technique. If you need only 1 or 2 files, just use the "put back" feature.

share|improve this answer

An AppleScript that "Put[s] back all items in the Trash" worked for me:

Open "AppleScript Editor" and copy/paste the lines below, then run the script as many times as needed.

tell application "System Events"
    tell process "Finder"
        repeat 100 times
            tell application "Finder" to open trash
            tell application "Finder" to activate
            key code 126
            key down command
            key code 51
            key up command
            delay 0.2 -- adjust delay as needed
        end repeat
    end tell
end tell
tell application "Finder" to close every window
share|improve this answer

Prior to Snow Leopard, OS X does not natively have the ability to restore files to their original locations that they were deleted from (as can be done natively in a Windows environment with the "Restore" option in the context menu for Recycle Bin). I accidentally did the same thing as your wife did at one point with around 10,000 plus files being deleted.

After exploring all my options I performed a system restore via Time Machine. It was by far the most expedient method to get said files to their proper locations.

share|improve this answer
1  
Well, as you can easily deduce from other answers here, it is possible to put back files/folders from Trash: open Trash, right-click a file and select "Put Back". –  patrix Oct 15 '12 at 18:52
  1. Open Terminal tool (In /Applications/Utilities)

  2. Make a directory called myStuff:

    mkdir myStuff
    
  3. Move the contents of the trash to the myStuff folder:

    mv .Trash/* myStuff
    
  4. The contents of the Trash will reside in folder myStuff.

There is no record of where things came from. You must restore manually.

share|improve this answer
2  
For 9000 files I would attempt to "undelete" as many as possible before resorting to this procedure. –  jaberg Jan 25 '12 at 3:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.