Results 1 to 5 of 5
-
09-29-2003, 09:01 PM #1Junior Guru
- Join Date
- Apr 2003
- Posts
- 187
ssh delete all .bak files in directory and sub dirs
i want to loggin to ssh on a hosting account and run some kind of find and delete comand. Basically ive got 4000 some odd filename.shtml.bak files i need to get rid of from one directory,and all its subs.
what command could i run to do this?
-
09-29-2003, 09:10 PM #2/home/xenos
- Join Date
- Jun 2002
- Posts
- 1,172
rm -rf *.shtml.bak
-
09-29-2003, 09:13 PM #3Junior Guru
- Join Date
- Apr 2003
- Posts
- 187
will this only delete files in the current directory and bellow....but not above?
-
09-29-2003, 09:18 PM #4Web Hosting Master
- Join Date
- Jul 2003
- Location
- San Antonio, Tx
- Posts
- 1,035
Then all you need to do is cd into a directory above the main one you want to delete and type:
rm -rf directorynamehere
This will remove the entire directory and all it's sub-directories.
-
09-29-2003, 10:28 PM #5Web Hosting Master
- Join Date
- May 2003
- Location
- Philadelphia
- Posts
- 970
your best solution would be something along the lines of
find /path/to/base/dir -name \*.bak -exec rm {} \;
What this does is basically find any files with the extension of .bak in /path/to/base/dir and any of its sub directories and executes the rm command to delete them.http://www.eBoundary.com - Let us help you expand your eBoundaries!
Fast, Secure and reliable FreeBSD shared, reseller and dedicated hosting.
FREE Peace of mind with every account!