Coying corresponding files
I have a folder structure where withing a parent folder called D there are 100s folders each with a name like u0001, u0002 and so on. I have two other folders names qb and kc which are outside D. Within the qb and kc folders there are corresponding files like u0001.qb and u0001.kc and so on. I'm looking for some scipts that can copy the .qb and .kc files to the corresponding folders in D. So the u0001.qb and u0001.kc files will be copied from qb and kc folders to the u0001 folders.Is there anyway that the script runs everyday automatically to update the folders? If one could help me would be obliged. Just I've been trying to help a charity.
Regarrds, Yan |
Pseudo code, since I don't know the exact structure of your
directory layout ... Code:
for i in /path/to/kc/*kc |
Dear Tinkster ,
Very kind of you for your code . I really appreciate this.Very kind of you. The directory structure is as follows. If you please tell me where to put the path would be great! There is a folder called D and within D there are folders with U0001,U00002......( there are 100s of folders) There is another two folders in the same level as D called KC(contain u0001.kc, u00002 and so on) and QB (contain u0001.qb, U0002.qb and so on). So the folder D, QB and KC all are on the same level I would like to run the script from the parent folder where is D, QB and KC exists. In your code, please let me know where to add the path. I really appreciate your help and would be obliged. I'm a medic and hence I appreciate help from people like you. |
The '/path/to' parts need to be replaced with your own full pathnames. Using full pathnames has the advantage that the script can run from any location (not just the parent folder), and that it also works correctly when launched by a cron job.
---------- T74marcell Arch Linux |
Quote:
Try this (make a back-up first ;}) Code:
#!/bin/bash |
Dear Tinkster,
Many thanks for the code. It gives an error `temp=$' unexpected ? Your help is appreciated. Regards, Yan |
Try to copy and paste code; it *should* just work - it
works here. If you can't copy and paste for some reason, make sure there's no space after the $ Cheers, Tink |
All times are GMT -5. The time now is 05:05 PM. |