Need some help with the terminal

Jump to First Reply
Posted:
in General Discussion edited January 2014
Hello, I'm new so I'm not quite sure how this works so I hope I'm posting this in the right place. I just got a mac a few weeks ago and I'm just scoping out it's features. At the moment I'm trying to find a way to use the terminal to delete all files in a folder with out deleting the actual folder itself. Or maybe moving the files to the trash can? Any help would be well appreciated. Thanks

Comments

  • Reply 1 of 2
    Marvinmarvin Posts: 15,585moderator
    mv <drag folder>* ~/.Trash



    Basically type mv then drag in a folder, add a * symbol at the end to signify all files and then put the URL to the user's trash folder.



    You would get something like this:



    mv /Documents/some_folder/* ~/.Trash



    It's better to not mess around with rm because you don't get any second chances with it and you can mess up some stuff badly if you mis-type URLs. Drag and drop is much safer.
     0Likes 0Dislikes 0Informatives
  • Reply 2 of 2
    Oh OK thanks, yea the only reason i wanted to use rm is so I could automate it using CronniX, but I like the idea of moving it to the trash better. Thank you you so much, works perfectly!!!
     0Likes 0Dislikes 0Informatives
Sign In or Register to comment.