Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Global Deleting with Wildcards
- Date: Sun, 19 Jan 2003 15:24:28 +0900
- From: Larry Stanbery <stanbery@example.com>
- Subject: Re: [tlug] Global Deleting with Wildcards
- References: <20030119.145746.59654382.acmuller@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
Charles Muller wrote: > When I do backups in DOS using batch files, I usually start off the > script with a couple of lines like this, that clean out all of the various > temp files so that they are not included in the backup set. > > del d:\docs\*.tmp /s > del d:\docs\temp.* /s > del c:\temp\~*.* /s > del c:\temp\*.*~ /s > ... "rm" will take wildcards, but it doesn't use the pattern to recurse subdirs -- instead, you'd need to use "find", like so: find . \( -name "*.tmp" -o -name "temp.*" \) -exec rm -f {} \; "find" recurses from a starting directory ("." in this instance) an runs a set of operations on each file. Here, we test to see if the name is *.tmp or temp.*, and if so, rm -f the file. Of course, you want to be careful with it. =) Check the man on "find" for lots more tests and operations and description. Word of warning: be careful of what your shell does to things like "~", since that might have special meaning. (No idea if it would actually mess with things, but it's safer to avoid it. =) Lastly, you might try that above command this way: find . \( name "*.tmp" -o -name "temp.*" \) -print to see which files it plans to jump on. Share and enjoy. Larry
- Follow-Ups:
- Re: [tlug] Global Deleting with Wildcards
- From: Charles Muller
- References:
- [tlug] Global Deleting with Wildcards
- From: Charles Muller
Home | Main Index | Thread Index
- Prev by Date: [tlug] Global Deleting with Wildcards
- Next by Date: Re: [tlug] Global Deleting with Wildcards
- Previous by thread: [tlug] Global Deleting with Wildcards
- Next by thread: Re: [tlug] Global Deleting with Wildcards
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links