From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rowan Eppelstun" Subject: Find command in shell script Date: Tue, 18 Jun 2002 12:24:18 +1000 Sender: linux-admin-owner@vger.kernel.org Message-ID: <000101c2166f$40d70710$697ba8c0@wrkeppo02> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: List-Id: Content-Type: text/plain; charset="us-ascii" To: linux-admin@vger.kernel.org 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