It's a perl script i have found in internet. Sorry I never gave a
thought it was not popular before recommending but I find it useful. Hey
your script below will do the job.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jhuniepi
Sent: Wednesday, April 05, 2006 12:02 PM
To: Philippine Linux Users' Group (PLUG) Technical Discussion List
Subject: Re: [plug] subtracting dates in bash script
what is filedate? command? there's no filedate command in my linux box.
btw, here my script now:
#!/bin/env bash
SRCDIR=./input
DESDIR=./error
find $DESDIR -amin +10 -cmin +10 -type f -exec mv '{}' $DESDIR \;
#script ends
On 4/5/06, Niel Ciriaco <[EMAIL PROTECTED]> wrote:
>
> Use filedate, substract current filedate with the filedate of your
> file in /dir1/sub1/ if result -gt 600 then move files
>
> Thanks,
> Niel
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of jhuniepi
> Sent: Wednesday, April 05, 2006 9:14 AM
> To: Philippine Linux Users' Group (PLUG) Technical Discussion List
> Subject: [plug] subtracting dates in bash script
>
> hello to all,
>
> in a directory there are list of files. /dir1/sub1/* i want to move
> those files in /dir1/sub1/* to /dir1/sub2/*, only if the file in
> /dir1/sub1/ is ten minutes older or more than the current datetime.
>
> i created a script but my problem is how do i know if file timestamp
> is older than the current datetime. it's like this: current datetime -
> file timestamp. how to do that in bash script?
>
> here's my incomplete script :
>
> #!/bin/env bash
>
> SRCDIR=/dir1/sub1
> DESDIR=/dir1/sub2
> now=(current date)
>
> cd $SRCDIR
> for f in *
> do
> ftimestamp=(file timestamp)
> if [ -f $f ]
> then
> if [ ($now - $ftimestamp) -ge (ten minutes) ]
> then
> mv $f $DESDIR
> echo $f moved to $DESDIR
> fi
> fi
> done
>
> #script ends
>
> TIA
> --
> cj pangilinan
> linux user, java programmer
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> [email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines:
> http://linux.org.ph/lists Searchable Archives:
> http://archives.free.net.ph
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> [email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines:
> http://linux.org.ph/lists Searchable Archives:
> http://archives.free.net.ph
>
--
cj pangilinan
linux user, java programmer
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines:
http://linux.org.ph/lists Searchable Archives:
http://archives.free.net.ph
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph