LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2009, 01:29 AM   #1
nanda22
Member
 
Registered: Mar 2008
Posts: 58

Rep: Reputation: 15
perl script get triggered when new file gets created


Hi
I would like to be able to have a perl script get triggered to run when a new file shows up in a directory, does anyone has solution for this?
Thanks in advance
 
Old 07-21-2009, 01:52 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
http://linux.die.net/man/1/dnotify
 
Old 07-21-2009, 02:09 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by nanda22 View Post
Hi
I would like to be able to have a perl script get triggered to run when a new file shows up in a directory, does anyone has solution for this?
Thanks in advance
if your requirement is not too complicated, just do something like this
1) create a dummy file in your directory
2) use find command with -newer option to find files that are newer than this dummy file

Code:
find /path -type f -newer dummy.txt
3) trigger your perl script if found, at the same time, touch the dummy file to create new timestamp
 
Old 07-21-2009, 02:19 AM   #4
nanda22
Member
 
Registered: Mar 2008
Posts: 58

Original Poster
Rep: Reputation: 15
Hi Chris, Thanks a lot.
I'm working with Perl on Windows (As i said, continuing the work of someone else's), how this dnotify or inotify compatible there? Can you please suggest me how can i incorporate them with perl script, as i read should give something like "use Linux::Inotify2;",if i've to use inotify. But how can i do with windows here?
Sorry to bother you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script for listing FTP usage as the file name of a file created in each share jojothedogboy Programming 1 12-05-2008 04:35 PM
Perl: Check if file has been created in the last 10 minutes introuble Programming 2 06-02-2006 11:58 AM
Perl Script to download file apt Programming 4 10-19-2005 09:33 AM
executing a time-triggered script leosuth Programming 7 06-02-2004 09:15 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 09:09 PM


All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration