ask-how to update files with the same name
Hi guys,
I have many small codes which have been used in many different folders. And those codes will get updated at times, so I wondering how can I update them in different folders at the same time instead of going into each folder to check whether there is any code that needs to be updated. I am thinking that at first I can find all the paths that contain the to-be-updated-codes, and them copy the new codes to those folders. But I don't know how to do this with linux commands, and any better suggestions? Thank you! Aaron. |
Hi,
not completely sure what you are actually asking, but the command rsync can be used to only copy files if the source file is newer (and different) to the destination file. Eg Code:
rsync -auv /path/to/source/ /path/to/destination/ See the rsync man page and search online for tutorials for more information. Evo2. |
clarify my question
Quote:
Sorry for my question. Let me clarify it: For example, if I have a code AAA, which has been used in ~/a1/ ~/a2/ ~/a3/a4/a5/ ... What I want to do is when AAA has been updated, I also want to update the AAAs in the above folders. If I used your suggested code or 'cp', the other question is how can I get all the paths containing the code AAA. Thank you. Aaron. |
Hi,
what do you mean by "a code"? Is this a file? If so you can use soft links. Just put the file in one directory and make the other link to it. Eg Code:
mkdir ~/a1/ |
All times are GMT -5. The time now is 07:51 PM. |