LinuxQuestions.org
Review your favorite Linux distribution.
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-27-2011, 04:32 PM   #1
bv2925
LQ Newbie
 
Registered: Jun 2011
Posts: 7

Rep: Reputation: Disabled
Post 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.
 
Old 07-27-2011, 05:22 PM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
perhaps this
Code:
#!/bin/bash
for directory in {Products,bin,admin,misc}
do
cp -rv /Oracle/$directory/* /apps/backup/$directory
done
 
Old 07-27-2011, 06:05 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Maybe something like 'rsync -ar /Oracle/ /apps/backup'?..
 
  


Reply

Tags
backup



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
Mapping /proc/scsi/scsi entries with respective device names in /dev/ directory neo3matrix Red Hat 2 04-21-2011 06:56 AM
find files with pattern, then copy those files to another directory ncsuapex Programming 4 08-13-2010 03:38 PM
How to Copy files from local directory to a particular directory using alias dynamics Linux - Newbie 7 09-11-2009 04:19 PM
How to copy files after search in array from this directory to another directory! phanvinhgiap Programming 4 01-04-2009 06:48 PM
copy files from directory to directory without subfile ALInux Linux - General 2 06-03-2005 11:51 AM

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

All times are GMT -5. The time now is 02:51 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