From mboxrd@z Thu Jan 1 00:00:00 1970 From: johnjulian1@netscape.net Subject: RE: Find command in shell script Date: Tue, 18 Jun 2002 07:19:56 -0400 Sender: linux-admin-owner@vger.kernel.org Message-ID: <057A7E84.6A49E01E.4DAE6F57@netscape.net> Content-Transfer-Encoding: 8bit Return-path: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: "\"Rowan Eppelstun\"" , linux-admin@vger.kernel.org remove the double quotes from FILENAME="'200206*.pdg'" remove the single quotes from '{}' remove the single quotes from ';' and preceed the ; with \ ie \; "Rowan Eppelstun" wrote: >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 > >- >To unsubscribe from this list: send the line "unsubscribe linux-admin" in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html > __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/