Monitoring file in a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Monitoring file in a directory
# 1  
Old 10-31-2005
Monitoring file in a directory

Hi I need the commands that will enable me to monitor the files in a directory, preferably by date of the file and copy those files that have changed to a new directory.


Please can someone help?

Many thnaks in advance

Kind regards from

Pete
# 2  
Old 10-31-2005
Please check the FAQs before posting. If you had looked here, you would have found your answer. Check the part where find is used in conjunction with touch.
# 3  
Old 11-12-2005
find and copy -mtime -newer cp

this was the code I came up with and it does not work.

Any suggestions are much appreciated.

#!/usr/bin/ksh

Path=/home/test1
Path2=/home/test2

if find -mtime $Path -newer $Path2
then cp $Path $Path2

fi
# 4  
Old 11-12-2005
Your syntax is incorrect. The '-mtime' argument expects to be followed by a positive/negative integer or an integer without any signs preceding it.
The mtime argument will find files older than/ newer than or exactly as old as the number of days specified. Please check the man page of find on your system for more details.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Realtime monitoring of files in a directory

Hello Experts, Here are my requirements. I want to monitor a directory and retrieve file properties like file names along with file sizes of files being generated today and that exceeds a threshold limit (say 10MB) using a shell script. Basically this shell script should monitor (kinda... (1 Reply)
Discussion started by: RamanM
1 Replies

2. UNIX for Dummies Questions & Answers

Control and monitoring file

Hi guys today i have new situation to resolve. I need to create a script that the first part it's already done but the problem appear when i run other sart_script inside of it. i need to check a log file until it stop after run the star script when the log file stop write, then make a copy file... (2 Replies)
Discussion started by: Newer
2 Replies

3. Shell Programming and Scripting

Control and monitoring file

Hi guys today i have new situation to resolve. I need to create a script that the first part it's already done but the problem appear when i run other sart_script inside of it. i need to check a log file until it stop after run the star script when the log file stop write, then make a copy file... (1 Reply)
Discussion started by: Newer
1 Replies

4. Shell Programming and Scripting

File monitoring script

Team, Attached 2 scripts for your validation(main script,mail script) Problem description: When its red it should wait for 10 seconds and then send a mail. If not red it should not send the mail i have done the below changes in the main script: if then if ... (4 Replies)
Discussion started by: whizkidash
4 Replies

5. Shell Programming and Scripting

Monitoring log file

Hi, I ned to monitor the tomcat log file called "catalina.out" for "Out of memory" error. the script should monitor this file and send us the mail as soon as it finds the string "Out of memory" in the file. can ypu suggest me which is the best way to do this? (4 Replies)
Discussion started by: shivanete
4 Replies

6. Shell Programming and Scripting

File Monitoring

Hi all I have a ftp server where file will be ftped and processed and archived in archive once it's processed. The expected time for processing is 10 mins. I want to send an alert if any file is not processed and stays in ftp location for more than 10 mins. Please give me an idea how to... (2 Replies)
Discussion started by: johnl
2 Replies

7. UNIX for Dummies Questions & Answers

monitoring a directory for changes

hi i need to monitor a directory for changes .. when ever a file is modified or created newly then the name of the file along with the user id and the ip address of the person who has created the file or modified it should be logged into a user specific file... (3 Replies)
Discussion started by: sais
3 Replies

8. Shell Programming and Scripting

file monitoring

hi all in my server all the users have the same paswd like "abc" .... i need to keep track of who changes the files using the ip addressess.... so once when a person logs in .. i need to monitor the actions or the files chagned by that person and store it in a log file .. can some one help me... (2 Replies)
Discussion started by: sais
2 Replies

9. Programming

file monitoring

Hi i am am monitioring a file every 60 seconds and checking if the file has changed and if it has changed i append the changes to another file. i am able to monitior the change in file size but i have a problem copying the changes made in the file to another file. i am using lseek to seek the last... (1 Reply)
Discussion started by: problems
1 Replies

10. Shell Programming and Scripting

Monitoring a directory for new files with .xx and executing command if found

Hi Guys. I am a complete shell scripting newbie with some syntax and commands understanding. I'm more of a win admin. With that said: I need to write a shell script to monitor a directory '/Mon_Dir' for new occurrences of files with .xx extension. Once a new file is detected in the directory, a... (4 Replies)
Discussion started by: krkan
4 Replies
Login or Register to Ask a Question