I want to move some files from one directory to another using a script.
I am using a cron job to call the script and need to have the errors
emailed to me (which is the default)
The files are created with rolling numbers so will always be different
names, same extension.
There may be none, one or many files in the directory.
I am probably going about it the wrong way, my scripting is very rusty. I
could try the /bin/ls and grep the result and see if it is too slow. I just
thought there may be an easy way I have overlooked.
what I am trying to achieve:
I want to check to see if there are any files to move (otherwise I get an
error message generated if there are none)
Then move the relevant files
eg:
if [[ -e *.TXT ]] ; then
mv *.TXT /tmp
fi
rgegards
Alister
----- Original Message -----
From: "Russell Davies" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 5:43 PM
Subject: Re: [SLUG] if [[ -e *.TXT ]] ; then
> ; how do I check that a file with a particular extension exists in a
directory
> ; in a shell script.
>
> a more relevant question is why do you want to? It sounds like you're
> checking to see if a file exists before you do something to it (process
> it, move it, delete it) this is a race condition and is considered to
> be bad programming. What are you really trying to do?
>
> r.
>
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug