.mta files - I can't delete them!

close, the -f is part of the rm (remove) command so should not be with the ls command

find /DataVolume/shares/ -type f -iname \*.mta -exec ls -ad {} ;

in putty just right click to past, click and drag to select or double click to select a word

no space between the {} brackets, there is a space between } and ;

for safety I would use the cursor keys, backspace & delete to change the ls -ad to rm -f, this helps eliminate typos in the command such as a space after the * which would delete all files under /DataVolume/shares.

any time I do a destructive find I make it a habbit to show the files 1st, then edit the command just to minimize the risk. if the ls does not return exacly what you expect, fix it before the rm as there is no real recovery from that.

also if you are not positive these .mta files are not needed you could do somthing like this which would rename the files by adding a .bak extension

find /DataVolume/shares/ -type f -iname \*.mta -exec ls -ad {} ;

find /DataVolume/shares/ -type f -iname \*.mta -exec mv {} {}.bak ;

and later on do:

find /DataVolume/shares/ -type f -iname \*.mta.bak -exec ls -ad {} ;

find /DataVolume/shares/ -type f -iname \*.mta.bak -exec rm -f {} ;

1 Like