Command to find a directory by name in linux
>find /share/backup/ -type d -name '.svn' -ls
-type d == directory
-name '.svn' == all directories named .svn
-ls == converts unusual characters to C style escape sequences
To delete the list of directories returned by the above command execute
>find /share/backup/ -type d -name '.svn' | xargs /bin/rm -dr
xargs builds and executes command lines from standard input
/bin/rm -dr == remove command with the directory and recursive flags
Friday, June 22, 2007
Subscribe to:
Post Comments (Atom)
2 comments:
How to find directory name more than one ? Lets say i have 10 directories start with 1 to 10.
I just want to find files inside directory 1 to 5 or 5 to 7, etc.
Is that possible?
try the following command that uses the regex switch:
find /share/backup/ -type d -regex "\d*.*"
Post a Comment