Linux-admin Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Rowan Eppelstun" <reppelstun@yahoo.com.au>
To: linux-admin@vger.kernel.org
Subject: Find command in shell script
Date: Tue, 18 Jun 2002 12:24:18 +1000	[thread overview]
Message-ID: <000101c2166f$40d70710$697ba8c0@wrkeppo02> (raw)

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


             reply	other threads:[~2002-06-18  2:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-18  2:24 Rowan Eppelstun [this message]
2002-06-18  5:19 ` rDNS blocked Kilaru Sambaiah
2002-06-18  6:57 ` Find command in shell script Camelia NASTASE
  -- strict thread matches above, loose matches on Subject: below --
2002-06-18 11:19 johnjulian1
2002-06-18 12:18 ` John Hallam
2002-06-18 12:29   ` John Hallam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000101c2166f$40d70710$697ba8c0@wrkeppo02' \
    --to=reppelstun@yahoo.com.au \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox