Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-22 Thread James Polley
On 22 May 2014, at 9:10, Kyle k...@attitia.com wrote: Hi folks, I was wondering what is the best (as in most efficient method) for doing an automated, scheduled recursive search and DEL exercise. The scheduled part is just a cron job, no problem. But what's the most efficient method

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-22 Thread Darragh Bailey
Hi Kyle, You might find it worth looking at the following invocation of find: find top_dir -name name_to_del -exec rm -rf {} \+ -prune the '+' will support expansion of arguments, thus it works exactly like xargs in building up a command line that is passed to rm. You may also need to specify

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-22 Thread Amos Shapira
On 22 May 2014 19:16, Darragh Bailey daragh.bai...@gmail.com wrote: Hi Kyle, You might find it worth looking at the following invocation of find: find top_dir -name name_to_del -exec rm -rf {} \+ -prune the '+' will support expansion of arguments, thus it works exactly like xargs in

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-22 Thread Kyle
Thanks to all for the responses. Interestingly, everyone has come back with find (followed by..) as the best option. Perhaps this is simply a reflection of the fact my 3 examples all used 'find'. I have always thought (believed) 'find' was a less efficient process than 'locate' and kind

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-22 Thread Amos Shapira
Locate only indexes path names, not other attributes (like type, size, time etc) On 23 May 2014 06:11, Kyle k...@attitia.com wrote: Thanks to all for the responses. Interestingly, everyone has come back with find (followed by..) as the best option. Perhaps this is simply a reflection of

[SLUG] Best (most efficient method) recursive dir DEL

2014-05-21 Thread Kyle
Hi folks, I was wondering what is the best (as in most efficient method) for doing an automated, scheduled recursive search and DEL exercise. The scheduled part is just a cron job, no problem. But what's the most efficient method to loop a given structure and remove all (non-empty)

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-21 Thread Zenaan Harkness
On 5/22/14, Kyle k...@attitia.com wrote: I was wondering what is the best (as in most efficient method) for doing an automated, scheduled recursive search and DEL exercise. The scheduled part is just a cron job, no problem. But what's the most efficient method to loop a given structure and

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-21 Thread Amos Shapira
(Sorry I'm writing from the phone and can't test exact solution) What's the context of this question? Do you really want to keep all empty directories? -delete will fail on non-empty directories. Use -print0 -prune | xargs -0 rm -rf to stop find from scanning the doomed directory. On 22 May 2014

Re: [SLUG] Best (most efficient method) recursive dir DEL

2014-05-21 Thread Kyle
Sorry, poorly worded. I want to to loop a given structure and remove . /[specific, named] /. (non-empty) directories below the top dir Kyle On 22-05-2014 14:12, Amos Shapira wrote: What's the context of this