LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2008, 10:34 AM   #1
irfanb146
LQ Newbie
 
Registered: Mar 2008
Posts: 19

Rep: Reputation: 0
How to automatically Copying file to other destination as soon as it is created


How to automatically Copying file to other destination as soon as it is created
 
Old 07-15-2008, 11:30 AM   #2
kernl
LQ Newbie
 
Registered: Oct 2007
Distribution: Ubuntu/RedHat/Debian
Posts: 9

Rep: Reputation: 5
It would be useful to supply more information about what it is you want to do, but here are some suggestions.
Your best bet would be a custom shell script and the use of the cron facility. Cron will run a script as many times as you ask it to, at regular intervals.
The content of the shell script, which is basically just a series of commands in an executable file, depends on whether you are copying the file to a filesystem destination or another system destination.
This is a sketchy answer, but the question was sparse on details. Hope this helps.
 
Old 07-15-2008, 11:53 AM   #3
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Well you got my attention.
Little less sketchy would be of interest
?????????????????????????????????????????????????????????????????????????????????????????
Don't see how it can be copied at the instant of Creation unless it is created by a Script that creates it in all desired locations at the completion of creation
?????????????????????????????????????????????????????????????????????????????????????????
obviously, if the directory where the file is to be intitially created is a known entity and is going to be empty at the time of the File Creation, the a script intiated by cron every second or what everm could do a cp file /X folowed by cp file /Y and finally followed by mv file /Z to clean up the initial directory preparatory to creation of the next file
?????????????????????????????????????????????????????????????????????????????????????????
 
Old 07-15-2008, 12:09 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Let's see:
a) you can create a new (empty) file with the touch command.
b) you can create a new file with the cp command (the copy didn't exist beforehand).
c) you can create a new file with the mv command (the renamed file didn't exist beforehand).
d) you can create a new file with any of several text editors.
e) you can create a new file with any of several wordprocessors and page-setup applications.

Each has it's own means of creating new files.

You would need a daemon to watch for the creation of new files and make copies of said files elsewhere. The daemon would need a set of rules to guide it: create new files if created by certain applications, but ignore new files resulting from package installation.

The problem as stated is much too broad for an easy answer.
 
Old 07-15-2008, 12:33 PM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
the cleaner way would be to use inotify
http://www-128.ibm.com/developerwork...l-inotify.html
 
Old 07-16-2008, 05:11 AM   #6
irfanb146
LQ Newbie
 
Registered: Mar 2008
Posts: 19

Original Poster
Rep: Reputation: 0
Does INOTIFY or dnotify take lots of resources
 
Old 07-16-2008, 06:25 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Why not change the original program to place the file(s) in the correct location in the first place?
Like others have already stated: the info given is to sparse to give a good answer.
 
  


Reply

Tags
copying, file



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically inherit parent folder permissions when copying files teixeira Linux - Newbie 3 07-08-2008 12:21 PM
Does a boot sector created automatically when install linux to a partition? just.srad Linux - General 7 04-18-2008 03:34 AM
Automatically set permissions of new files created within a specific folder Lorian Linux - Desktop 2 03-03-2007 03:17 PM
Copying Files from one source to a destination vgdeveloper05 Programming 1 12-10-2006 02:28 PM
device icons created automatically after reboot mushmaster Linux - Newbie 2 08-14-2004 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration