Watch and copy a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Watch and copy a file
# 1  
Old 07-02-2009
Watch and copy a file

I need to write a simple shell script to watch a file in a directory and copy immedietly any files in that directory to another oldfiles directory once and later in the evening delete the file from the original directory.

File A arrives in dir1 at 8.00AM
Watch the file in dir1 and copy the file immedietly by appending time to another oldfiles directory.
Leave the orig file in dir 1 until end of day. End of day move the file to a directory called deleted with timeappend.

Need to keep a track of what time the file came. The file triggers some other process , so need to keep in the original directory for the whole day and move it in the evening.

This has to be done 24X7
# 2  
Old 07-02-2009
Are you on Linux - you can use inotify to inform you of directory changes - ie., the addition of a file.
# 3  
Old 07-05-2009
I am Sun Solaris
 
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

2. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

3. UNIX for Advanced & Expert Users

Watch directory and move specific file extensions

Hi all, This is actually more for my lazyness then anything else, but I think others might find it useful to use as well. Basically this is what I am trying to achieve... In my ubuntu home dir under Downloads is where firefox saves everything by default, now I know that you can manually... (3 Replies)
Discussion started by: STOIE
3 Replies

4. UNIX for Dummies Questions & Answers

Watch for File on Windows share using Shell Script

I want to poll a particular file on a Windows shared drive using shell script and copy it to a Unix directory if present. Step wise execution: 1) Poll/watch for a file in the following location on Windows share: (SRC_DIR=\\mum\dharmesh\research\ST_DXR_20080821 to DXR.xls) 2) If present,... (1 Reply)
Discussion started by: dharam_v
1 Replies

5. Shell Programming and Scripting

Watch for File on Windows share using Shell Script

Watch for File on Windows share using Shell Script I want to poll a particular file on a Windows shared drive using shell script and copy it to a Unix directory if present. Step wise execution: 1) Poll/watch for a file in the following location on Windows share:... (1 Reply)
Discussion started by: dharam_v
1 Replies

6. Programming

How to watch for file creation/deletion?

How do I write a C program that will watch a directory for file creation/deletion? Maybe it would receive a signal when someone creates a file? thanks, Siegfried (5 Replies)
Discussion started by: siegfried
5 Replies
Login or Register to Ask a Question