LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 12: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, 12:52 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
http://linux.die.net/man/1/dnotify
 
Old 07-21-2009, 01: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, 01: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



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 03:35 PM
Perl: Check if file has been created in the last 10 minutes introuble Programming 2 06-02-2006 10:58 AM
Perl Script to download file apt Programming 4 10-19-2005 08:33 AM
executing a time-triggered script leosuth Programming 7 06-02-2004 08:15 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:23 PM.

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
Open Source Consulting | Domain Registration