miércoles, 3 de septiembre de 2008

Fast delete of files or directories in Linux using find

Let's suppose you have an structure like this:


mx.com.CVS
mx.com.dtc.ayde
mx.com.dtc.ayde.applet
mx.com.dtc.ayde.applet.CVS
mx.com.dtc.ayde.busquedas
mx.com.dtc.ayde.busquedas.CVS
mx.com.dtc.ayde.client


and you want to delete those directories with the name CVS, so, go to the root
directory of those you want to delete (in this case
/ ), and execute the following:


find . -type d -name CVS -exec rm -rf {} . \;

or

find . -type f -name *.db -exec cp {} . \;

for files that end with extension
db

the
. and \; are very important!


Regards,

Barenca

No hay comentarios.: