[Novalug] rm question

Brandon Saxe brandon20va@yahoo.com
Thu Oct 10 12:14:11 EDT 2013


The Perl File::Find module is useful for things like this, especially if you want to make a more permanent program and save it for later.

http://perldoc.perl.org/File/Find.html

find2perl looks interesting as well.




On Thursday, October 10, 2013 12:10 PM, William Sutton <william@trilug.org> wrote:
the below is clearly by someone who knows what he's doing, rather than my 
FAILblog solution :-)

William Sutton


On Thu, 10 Oct 2013, Jared Scott wrote:

> find /path -name \*.ext1 -exec echo rm -f {} \; -o -name \*.ext2 -exec rm -f
> {} \;
> 
> You may want to test it first with:
> find /path -name \*.ext1 -exec echo rm -f {} \; -o -name \*.ext2 -exec echo
> rm -f {} \;
> 
> 
> This will echo all of the file names to the screen so you can make sure it
> is going to do what you want.
> 
> The /path can be the relative path, or the absolute path.
> 
> 
> On Thu, Oct 10, 2013 at 11:55 AM, Roy Wilson <emperor_wilson@verizon.net>
> wrote:
>
>         Dumb question...
>
>         I've tried every pattern of swapping switches, directories,
>       etc and I can't get rm to do what I want.
>
>         I've got a 2tb drive with something on the order of 17,000
>       directories on it.
>
>         Most of those directories have several files with the same
>       data in different formats.
>
>         I want to delete some of those formats.
>
>         rm -r *.ext1 *.ext2 etc works - but only in the directory I'm
>       physically in - it doesn't recurse all the subdirectories.
>
>         I KNOW this can be done.  Someone please tell me the (probably
>       obvious) correct command syntax is to get it to do what I want -
>       please?
> 
> 
> 
> 
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug
> 
> 
> 
>

_______________________________________________
Novalug mailing list
Novalug@calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug




More information about the Novalug mailing list