Thank you Mr. G. Briones. I hope to see you this coming plug seminar.
Sana available ka.
And thank you also Mr. J. Mallen.
I used the first one, using find, coz it's simple, i don't have to
write if statement. find will test the file if it is > 10 mins.
Question: yung find command ba isa isa nya pinaprocess yung file pag
nakita nya? for ex: 3 fiels dapat nya makita, pag nakita nya yung isa,
imomove ba kagad nya, based on my script?

On 4/6/06, Jed R. Mallen <[EMAIL PROTECTED]> wrote:
> On 4/5/06, jhuniepi <[EMAIL PROTECTED]> wrote:
> > 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?
>
> Using stat and data commands:
>
> date +%s --> epoch seconds from present date
> stat -c %Y $file --> epoch seconds of target file
>
> You can expand more from this:
>
> x-- begin snip --x
>
> test $(expr `date +%s` - `stat -c %Y $file`) -ge 600\
>     && echo "$file modified more than 10 mins ago"
>
> x-- end snip --x
>
> Or if you like to use `find`:
>
> x-- begin snip --x
>
> if [ "`find $FILE -mmin +10`" ]
> then
>     echo "$FILE is more than 10 minutes old"
> else
>     echo "$FILE is a youngster"
> fi
>
> x-- end snip --x
>
> Hope this helps.
>
> --
> Jed R. Mallen
> GPG key ID: 81E575A3 fp: 4E1E CBA5 7E6A 2F8B 8756  660A E54C 39D6 81E5 75A3
> http://jed.sitesled.com
> _________________________________________________
> 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

Reply via email to