I have a question that may seem very insignificant to some but is one that I've been trying to address for the past several days (haven't had any luck looking online).
I'm trying to clean a directory by removing old files that we no longer need. I'm using wildcards to do this but I am finding that, because of how the files are named, it's taking quite a bit of time to remove all of them. Just to allow for a clearer understanding of what I'm talking about, here's an example of the types of files I'm dealing with:
I've been, so far, removing these files one month at a time using this command:
rm loep_April-??-2010*
The problem is that with the above command I can only delete those files from April which, consequently, slows me down significantly since I have to do the same for May, June, August, etc.... So, my question is, is there any other way for me to actually delete all files for, say, 2010 without doing it month by month? I've tried several combinations of the above command, placing the wildcard right after loep, etc., but without success.
Any help on this will be appreciated.
Rob
Last edited by radoulov; 07-08-2011 at 02:17 PM..
Reason: Code tags.
greetings,
below is the find command i am using for some filesystem maintenance:
find /data/Engine \( -type d -name .snapshot -prune -o -type d -wholename "/data/Engine/*/CAE" \
-prune -o -type d -wholename "/data/Engine/*/CAD" -prune -o -name ".*.case" \)\
-mtime +365 -print0 -fls... (5 Replies)
I have the following script (parts from help on this forum, thanks y'all):
#!/usr/bin/ksh
date '+%m %d %Y' |
{
read MONTH DAY YEAR
DAY=`expr "$DAY" - 1`
case "$DAY" in
0)
MONTH=`expr "$MONTH" - 1`
case "$MONTH" in
0)
... (5 Replies)
These 2 websites do a GREAT job of explaining different types of wildcards. I learned about the categories of characters which I never knew about at all.
GNU/Linux Command-Line Tools Guide - Wildcards
GREP (1 Reply)
Is there some rule about using wildcards in path? Say I want to create a file, but one of the directories in the path is called 1433d.default and on different machines it will be called <some other string>.default
touch ~/Library/Application/*.default/myfile
In theory I thought that... (5 Replies)
Hi All
Please excuse another straightforward question. When creating a tar archive from a directory I am attempting to use wildcards to eliminate certain filetypes (otherwise the archive gets too large). So I am looking for something along these lines.
tar -cf archive.tar * <minus all *.rst... (5 Replies)
Hi there,
is it possible to use wild cards in this statement
ssh $remote_server 'perl -pi -e "s,EXP_SERIAL_19b8be67=\"\",EXP_SERIAL_`hostid`=\"UNKNOWN\"," /var/myfile'
This command works fine but the bit in bold (the 8 character hostid) will not always be 19b8be67 so I was hoping I could... (2 Replies)
ok, I'm trying to write a script file that lists files with specific elements in the name into a txt file, it looks like this
ls s*.dat > file_names.txt
can't figure out whats wrong with that line, any ideas?
thanks in advance (10 Replies)
when writing a shell script (bourne) and using a unix command like 'ls' is there anything special you need to do to use a wildcard (like *)? (3 Replies)
on my SCO UNIX wild cards are not displaying wanted result.
Why like that . I think that i was not using proper command .
what are there . how can i use the wildcards in UNIX. (7 Replies)
I'm trying to delete lines from a large text file using VI.
Every line that I am wanting to delete start with 'S' - all others do not. (A list of users)
I've tried using * but doesn't seem to like it...any ideas...
Doesn't have to be VI - but I'm better with VI than sed/awk. (8 Replies)