If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Polling a directory for changes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-25-03, 15:59
Racer_X Racer_X is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
Polling a directory for changes

Is there an easy way to poll (monitor) a directory, to see if any new folders have been created in it?
Reply With Quote
  #2 (permalink)  
Old 11-26-03, 08:54
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
There might be an easier way that I'm overlooking but you could do it in a fairly primitive fashion like this...

ls -l someDirectory > originalDirectoryStatus
while :; do
sleep 600
ls -l someDirectory > newDirectoryStatus
diff originalDirectoryStatus newDirectoryStatus > directoryStatusInfo || DO_STUFF_WITH_STATUS_INFO
mv newDirectoryStatus originalDirectoryStatus
done

HTH
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On