LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy files to a respective directory (http://www.linuxquestions.org/questions/linux-newbie-8/copy-files-to-a-respective-directory-894157/)

bv2925 07-27-2011 04:32 PM

Copy files to a respective directory
 
Hi,
I am trying to read mulitple files and copy its contents (files) to a respective directory.
I have a folder "Oracle". Under this i have mulitple files as mentioned below.
Products bin admin misc etc
each of the above has a list of files in them.
Now i have created new directories with the same name as the above files in another location say
/apps/backup/Products
/apps/backup/bin
/apps/backup/admin
/apps/backup/misc
.
.
.
The script that i looking at has to read the files from Oracle,
backup its contents to its appropriate new directory.
Example:
read /Oracle/Products and backup the files mentioned in there to /apps/backup/products.
read /Oracle/bin and backup the files mentioned in there to /apps/backup/bin.
.
.
.

Can the pro's help me out with this.
Thanks in advance.

frieza 07-27-2011 05:22 PM

perhaps this
Code:

#!/bin/bash
for directory in {Products,bin,admin,misc}
do
cp -rv /Oracle/$directory/* /apps/backup/$directory
done


unSpawn 07-27-2011 06:05 PM

Maybe something like 'rsync -ar /Oracle/ /apps/backup'?..


All times are GMT -5. The time now is 11:59 PM.