How can I remove folders across all of my volumes?

  • BPMb
  • Born
  • Born
  • BPMb
  • Posts: 1

Post 3+ Months Ago

Hi there!

for a program I'm administrating it is sometimes necessary to delete several folder across all the volumes. I'd like to make a script for that but can't get it to work.. I've tried this:

sudo rm -r /Volumes/*/Folder\ to\ delete/

but that didn't work.. I also tried

sudo find / -iname filetodelete | rm -r

to feed the output to rm but this didn't work and also took a very long time to complete.. I couldn't find this information anywhere but I'm hoping someone here knows the answer? Thanks ahead anyway..
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • mo_mughrabi
  • Student
  • Student
  • User avatar
  • Posts: 73

Post 3+ Months Ago

if you want to remove all folders including the files inside

rm -Rf `ls -ltr /Vol*/*/|grep drw|awk {'print $9'}`

BE AWARE THIS WILL REMOVE ALL DIRECTORIES IN ALL VOLUMES!
to see what will be removed try

ls -ltr /Vol*/*/|grep drw|awk {'print $9'}

this will five you a quick preview before you proceed..

Cheers,
  • bleepnik
  • Professor
  • Professor
  • User avatar
  • Posts: 971
  • Loc: South Jersey, US

Post 3+ Months Ago

BPMb doesn't want to delete all directories across all volumes, just "several" of them.
  • mo_mughrabi
  • Student
  • Student
  • User avatar
  • Posts: 73

Post 3+ Months Ago

Is there anything in comma between these folders? naming schema, mod, owner..etc?

If so, then you can find folders using certain criteria and accordingly delete files..

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.