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


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Is there any way to find any changes made to a directory?
# 1  
Old 01-23-2008
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...??
# 2  
Old 02-13-2008
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.
# 3  
Old 02-13-2008
touch -t 0802130800 /tmp/date
find . -newer /tmp/date -mtime 0
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find and get a file in an entire directory with an excluded directory specified?

How to get a file 'zlib.h' in an entire directory with an excluded directory specified lives under that starting directory by using find command, as it failed on: $ find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print it'll just list entirely up (2 Replies)
Discussion started by: abdulbadii
2 Replies

2. Shell Programming and Scripting

Find every directory named XYZ under the DVLP directory

I only want to find files under each branch of the directory tree inside directories named XYZ and there are multiple XYZ directories? (7 Replies)
Discussion started by: emc^24sho
7 Replies

3. UNIX for Dummies Questions & Answers

"-maxdepth 1" argument for Solaris find. Other way to restrict find in only one directory?

Hi I wish to find only files in dir /srv/container/content/imz06/. It means exclude subfolder /srv/container/content/imz06/archive/ > uname -a SunOS testbox6 5.10 Generic_139555-08 sun4v sparc SUNW,Sun-Blade-T6320Its Solaris default "find" > find /srv/container/content/imz06/* -name... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

4. UNIX for Advanced & Expert Users

find directory help

I am looking for the directory ".Private". Can someone tell me why my first search does not work? ~ $ sudo find / -iname -type d ".Private" 2>/dev/null And why does this one work? ~ $ sudo find / -type d -iname '.Private' 2>/dev/null... (3 Replies)
Discussion started by: cokedude
3 Replies

5. Shell Programming and Scripting

Find Directory help

Hey All, New to Bash Scripting I have a find command to count the current directories it is: dirCount=`find $2/ -type d | wc -l` What I get is a count of all directories in $2 as well as $2 itself. What I need to do is ignore $2 itself and just get the folders inside $2. Thank in... (6 Replies)
Discussion started by: brandonpal
6 Replies

6. UNIX for Dummies Questions & Answers

Script to find a string in a directory/sub-directory

I'm trying to find this string 'preparing string IBE_Quote_W1_Pvt.SaveWrapper for quote_header_id’ in my Apache log file directory. The log file that contains this string may be in a parent direcotry or a sub-directory. I have tried 'grep' and 'awk' with no success. I would like to get the path... (3 Replies)
Discussion started by: gross
3 Replies

7. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

8. Shell Programming and Scripting

Find the size of a directory

Hi, I would really appreciate if you could help me with this. I have a directory structure like this :- /data Under data i have directories /data1 , /input_files , /output_files etc . Under these directories I have other subdirectories. What i am looking for is to find out the size of all... (5 Replies)
Discussion started by: divz
5 Replies

9. UNIX for Dummies Questions & Answers

find particular directory

Hi, i know only directory name I want to find location of tat directory(full path) is there any option to find directory (1 Reply)
Discussion started by: arulkumar
1 Replies

10. UNIX for Advanced & Expert Users

find - directory only

All, I want to find ONLY the directories containing ...say "*.log" under some $MY_HOME. man on find does not seem to yield any suitable option for me. need to do this on a Sun system. help (verily) appriciated. (:) ) Regards (4 Replies)
Discussion started by: ipzig
4 Replies
Login or Register to Ask a Question