How to automatically Copying file to other destination as soon as it is created
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
?????????????????????????????????????????????????????????????????????????????????????????
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.