[Novalug] rm question

Derek LaHousse dlahouss@mtu.edu
Thu Oct 10 17:00:16 EDT 2013


How many ways CAN we skin a cat?

On Thu, Oct 10, 2013 at 4:52 PM, shawn wilson <ag4ve.us@gmail.com> wrote:
> Depending on the filesystem, xargs -P5 (or so) might be faster.
>
> As mentioned there's also a perl find module and find2perl and just
> put 'unlink $_' in wanted.
>
> The simplest solution (depending on your structure) might be: rm -f */*.ext
>
> Also, in pure bash (untested)
> for path in $(ls -R); do rm -f ${path/\.ext$/}; done
>
>
> On Thu, Oct 10, 2013 at 3:19 PM, John Holland <jholland@vin-dit.org> wrote:
>> I think that should have been
>>
>> for i in `find . -print | egrep \(mp3\|m4a\)$ `; do echo  rm \"$i\" >>
>> /tmp/script1;done
>>
>>
>>
>>
>> On 10/10/2013 01:44 PM, John Holland wrote:
>>
>> I never learned hardly any options to find.
>>
>>
>> Here are commands that generate a script to remove all my music files
>> "mp3" and "m4a" from the current directory (.)
>>
>> SAVEIFS=$IFS
>> IFS=$(echo -en "\n\b")
>> for i in `find . -print | egrep [mp3\|m4a]$ `; do echo  rm $i >>
>> /tmp/script1;done
>> IFS=$SAVEIFS
>>
>> Then you can examine the script before running it to be sure and not
>> lose any valuable files.
>>
>>
>> On 10/10/2013 01:02 PM, Soren Harward wrote:
>>
>> find /path/to/directory -type f -iname "*.ext1" -o -iname "*.ext2" -delete
>>
>> is the most straightforward, and likely fastest, way to remove all the
>> files underneath /path/to/directory that end with either .ext1 or
>> .ext2 .
>>
>> 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
>>
>>
>>
>> _______________________________________________
>> 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