FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Red Hat Linux

 
 
LinkBack Thread Tools
 
Old 10-29-2010, 09:23 AM
Humphrey Widjaja
 
Default Command to check that a directory changes

Try using stat, example:

OLD=`stat -t testdir`
while true
do
NEW=`stat -t testdir`
[ "$NEW" == "$OLD" ] || echo "changed!"
sleep 3
done

Best Regards,


Hum / Humphrey K. Widjaja



On Fri, Oct 29, 2010 at 5:08 PM, ESGLinux <esggrupos@gmail.com> wrote:
> Hi all,
>
> Im making a bash script and I need to know when a new file appears in a
> directory.
>
> anybody knows if is there a command that to that or i need to use a
> commbination of some commands *(ls, wc, sleep, cron...)
>
> Thanks in advance
>
> ESG
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 10-29-2010, 09:24 AM
Eugene Jansen van Rensburg
 
Default Command to check that a directory changes

You can use aide

http://aide.sourceforge.net/

you will have to do some scripting around it but it will work

regards

--

Eugene Jansen van Rensburg
eMail: eugenejvr@gmail.com

"Quit is NOT an option"


On Fri, Oct 29, 2010 at 11:08, ESGLinux <esggrupos@gmail.com> wrote:
>
> Hi all,
>
> Im making a bash script and I need to know when a new file appears in a
> directory.
>
> anybody knows if is there a command that to that or i need to use a
> commbination of some commands *(ls, wc, sleep, cron...)
>
> Thanks in advance
>
> ESG
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 10-29-2010, 09:28 AM
Rohit khaladkar
 
Default Command to check that a directory changes

You might take the count of the files in the directory and store it in a
file. Run the same script again and compare the count.

the script can be put in the crontab for the same.

Thanks!
Rohit Khaladkar

On Fri, Oct 29, 2010 at 2:38 PM, ESGLinux <esggrupos@gmail.com> wrote:

> Hi all,
>
> Im making a bash script and I need to know when a new file appears in a
> directory.
>
> anybody knows if is there a command that to that or i need to use a
> commbination of some commands (ls, wc, sleep, cron...)
>
> Thanks in advance
>
> ESG
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>



--
Thanks!
Rohit Khaladkar
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 10-29-2010, 02:37 PM
inode0
 
Default Command to check that a directory changes

On Fri, Oct 29, 2010 at 4:08 AM, ESGLinux <esggrupos@gmail.com> wrote:
> Hi all,
>
> Im making a bash script and I need to know when a new file appears in a
> directory.
>
> anybody knows if is there a command that to that or i need to use a
> commbination of some commands *(ls, wc, sleep, cron...)

You might find inotifywait useful for this.

John

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 11-04-2010, 08:52 AM
ESGLinux
 
Default Command to check that a directory changes

Hi,.

finally I have used your solution but with the -c option of stat:

stat -c "%z" $DIR

I have used that because my script access the dir to copy/check files and
that generates new changes using -t option

Thank you very much for your help

ESG



2010/10/29 Humphrey Widjaja <hwidjaja@gmail.com>

> Try using stat, example:
>
> OLD=`stat -t testdir`
> while true
> do
> NEW=`stat -t testdir`
> [ "$NEW" == "$OLD" ] || echo "changed!"
> sleep 3
> done
>
> Best Regards,
>
>
> Hum / Humphrey K. Widjaja
>
>
>
> On Fri, Oct 29, 2010 at 5:08 PM, ESGLinux <esggrupos@gmail.com> wrote:
> > Hi all,
> >
> > Im making a bash script and I need to know when a new file appears in a
> > directory.
> >
> > anybody knows if is there a command that to that or i need to use a
> > commbination of some commands (ls, wc, sleep, cron...)
> >
> > Thanks in advance
> >
> > ESG
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> >
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 11-04-2010, 09:05 AM
ESGLinux
 
Default Command to check that a directory changes

2010/10/29 inode0 <inode0@gmail.com>

> On Fri, Oct 29, 2010 at 4:08 AM, ESGLinux <esggrupos@gmail.com> wrote:
> > Hi all,
> >
> > Im making a bash script and I need to know when a new file appears in a
> > directory.
> >
> > anybody knows if is there a command that to that or i need to use a
> > commbination of some commands (ls, wc, sleep, cron...)
>
> You might find inotifywait useful for this.
>
> John
>
>
wow!

Very good command. I didnt know about it but it looks very powerfull.

I have solved my problem using stat but this command is better!!!

Thank you very much

ESG




> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 

Thread Tools




All times are GMT. The time now is 07:15 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org