Find command in shell script
Hi,
I am trying to do the following command in a script but cannot seem to get the escape characters right for the find - exec mv command.
I am trying to move all files named 200206*.pdf to a subdirectory of their currnet directory called "jun". Once I get the syntax correct for this I will automate it for the year, but have got stuck at this bit.
Could anyone please advise what I am missing.
----------------------------------------------------------------------------
-------------
#!/bin/sh
MONTH='date +%m'
DATE='date +%Y%m'
DIR=/home/rowan/eod/2002/ba
if DATE=200206; then FILENAME="'200206*.pdf'"
fi
if MONTH=06 ; then MONDIR=$DIR/jun/
fi
cd $DIR
pwd
find ./ -name $FILENAME -exec mv -f '{}' $MONDIR ';'
exit 0
----------------------------------------------------------------------------
------------------
Thanks in advance.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
rDNS blocked
Hi,
What is meant by rDNS blocked with 127.0.0.2. My mail server is not open
relay bust still blocked by osirusoft.org. How to solve this issue. I see very little documentation on their web page and net.
thanks,
Sam
try with FILENAME="200206*.pdf".
Quoted 35 lines
-------------
#!/bin/shMONTH='date +%m'
DATE='date +%Y%m'
DIR=/home/rowan/eod/2002/baif DATE=200206; then FILENAME="'200206*.pdf'"
fiif MONTH=06 ; then MONDIR=$DIR/jun/
ficd $DIR
pwd
find ./ -name $FILENAME -exec mv -f '{}' $MONDIR ';'
exit 0
----------------------------------------------------------------------------
------------------Thanks in advance.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Camelia Nastase, [email protected] Network Administrator Dynamic Network Technologies, Romania Tel: +40-1-2106863 Fax: +40-1-3122745