Terminal move to trash and allow put back

Discussion in 'OS X Yosemite (10.10)' started by gabrielcik, Jun 28, 2015.

  1. gabrielcik macrumors newbie

    Joined:
    Apr 25, 2015
    #1
    Hi,

    I use this command for to move a file to trash from terminal (within automator), it is not the only action it perform.

    mv /directory/{files i need to move} ~/.Trash

    I works but doesn't provide the possibility to "put back" files... is there a way for to get also this option?

    any suggestion is appreciated.
    Thanks:)
     
  2. Toutou, Jun 29, 2015
    Last edited: Jun 29, 2015

    Toutou macrumors 6502a

    Toutou

    Joined:
    Jan 6, 2015
    Location:
    Prague, Czech Republic
    #2
    mv ~/.Trash/{files you need to move} {where to move them}
    - that's obvious, but as for putting those files where they belong, i don't believe there is a specific terminal command for that. .Trash is just an ordinary folder for Bash. Maybe there is an AppleScript command for that?

    edit: Ok, maybe I misunderstood. You're looking for a way to move files to trash "natively", with the "Put back" option available, correct?

    http://stackoverflow.com/questions/25029623/how-to-move-a-file-to-trash-in-applescript
    Try this. If you want it to be intelligent and know that the file has been trashed and its original location, use AppleScript. Bash scripting is pretty low-level. The mv command just moves the file into the Trash folder, without letting the system know "hey, this file goes to trash, maybe remember where it came from if we needed it back"
     

Share This Page