Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gabrielcik

macrumors newbie
Original poster
Apr 25, 2015
13
0
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:)
 
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"
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.