im looking for a script that will search a directory and its sub-directories to find files within them and to delete those files. any ideas how id go about it?
Check the find man page, lets you search a folder and all its sub-directories for files based on a multitude of parameters such as name, size, modified date etc and then run a command against these files such as rm -f
Code:
find . -name foo -exec rm -f {} \;
Would find all files named foo in the current directory and all subdirectories and then remove them without prompting
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.