The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM


UNIX and Linux Applications Questions involving software not covered by other forum go here. This includes Databases and Middleware.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
monitor changes made by root scriptarg UNIX for Dummies Questions & Answers 0 07-08-2007 07:42 AM
Made command into a script but now won't run patwa UNIX for Dummies Questions & Answers 9 06-15-2007 06:28 PM
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 5 10-25-2006 02:39 PM
Can this be made into one single line? nmsinghe Shell Programming and Scripting 6 09-20-2002 08:58 AM
How do i check if changes were made to a file using vi TRUEST Shell Programming and Scripting 1 03-11-2002 06:49 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2008
Registered User
 

Join Date: Jan 2008
Location: Bangalooru
Posts: 15
Is there any way to find any changes made to a directory?

Hi groupies.

Is there any way to find any changes made to a directory?



Changes are adding a file to the directory or removing a file.



That is, I need to get the name of the file which is added or removed.





For adding,

I think one way of doing it, is by creating a script to access creation time or modification time frequently. If there are any files with timestamp grater than the “time” previously saved get the file name of it.

Will this works….?? or is there any function to trigger...??
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-13-2008
agn agn is offline
Registered User
 

Join Date: Feb 2008
Posts: 76
One possible solution is find(1)'s -(a|c)newer flags. For that you need to know the last file created/accessed. Then use that file to find the latest ones. You could also use a default file, perhaps a hidden file, and use touch(1) to update the access time of this file everytime there's a new file.

Inorder to get the name of a deleted file, you'll prolly have to save the filenames somewhere. And then compare this list with the current filenames in the directory.
Reply With Quote
  #3 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Dec 2006
Posts: 55
touch -t 0802130800 /tmp/date
find . -newer /tmp/date -mtime 0
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0