The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to copy Folder with FTP heru_90 Shell Programming and Scripting 1 08-22-2006 08:17 PM
how to copy hidden files from one folder to another rajan_ka1 UNIX for Dummies Questions & Answers 1 11-07-2005 05:04 AM
Compress and copy a Folder scorpiyanz UNIX for Advanced & Expert Users 1 08-19-2005 10:53 AM
copy folder contents robsk8_99 UNIX for Dummies Questions & Answers 1 02-22-2005 02:54 PM
copy folder tamemi UNIX for Dummies Questions & Answers 1 04-04-2004 07:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008
Registered User
 

Join Date: Aug 2001
Posts: 58
Auto copy for files from folder to folder upon instant writing

Hello all,
I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written.

I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me scenario because the written files to /path/to/a/ gets deleted on random timing sometimes the file get written and deleted in less than 5 seconds sometimes its over a minute or hours.

is there a technique in unix that i'm unaware of that does this?

Platform is mostly Linux flavors such as redhat/centos/debian or FreeBSD

Thank you.
Bashar
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-15-2008
Registered User
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 250
Bad approach imho. Please tell us why you aren't using network filesystem or san concepts.
Otherwise man inotify for 2.6 kernels and man fcntl for 2.4 kernels searching for F_NOTIFY.
Reply With Quote
  #3 (permalink)  
Old 08-21-2008
Registered User
 

Join Date: Aug 2008
Posts: 1
I'm trying to do something similar and have been reading posts and experimenting all day. On my team, we sometimes modify a file with vi but forget to stop and make a backup copy of the original first. You can imagine that "rollback" is almost impossible with this little "problem."

I'd like to do an automatic copy, date/time stamp automatically appended to the file name, and alias vi to call this automatic copy script as follows:

vi <file>
file is automatically copied to <file>.00814201440
make your changes
quit vi

If you worked out this problem or (anyone) came up with an answer or can, please let me know, thanks!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:30 PM.


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

Content Relevant URLs by vBSEO 3.2.0