Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find if file has been modified 1

Status
Not open for further replies.

sourabhjha

Programmer
Jan 13, 2002
121
IN
Hi,
I have a requirement where i need find out if any of the files in a given folder has been modified(modification in the file content).I plan to set this script in my crontab and run it once daily.Thus i can know if any of the files in the given folder were modified during the day.How shall i accomplish this.
One thing which i have in mind is that i can check the timestamp and size of these files from the daily backups which is taken for these files.And log the changes thus if found for any file.
Is there any better way to acheive this? And also is there anyway to do a file comparision in solaris so as i can also know the exact modification done in the file.

Thanks,
-Sourabh
 
man find
man diff

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
yes i cud work out with find mtime option and the diff commands.
Thanks.
 
I'd recommend checking the files into a version control system like CVS and then synchronizing the files with the repository every night. The synchronization will tell you if the file was modified and you'll have a complete history of the changes in the file.
 
man stat and man 2 stat.
What are you looking to do exactly?
 
You could also use various checksumming utilities.

Try: [tt]sum[/tt], [tt]cksum[/tt], or [tt]md5sum[/tt].

You can store a file containig checksums for each file you want to track; when the files change, the checksums change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top