Copying files from various folders to similar folder structure in another location


View Poll Results: Script to copy files from one location to user defined locations
mail 0 0%
tet 0 0%
rtwest 0 0%
test 0 0%
Voters: 0. This poll is closed

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copying files from various folders to similar folder structure in another location
# 1  
Old 05-23-2014
Copying files from various folders to similar folder structure in another location

Hi,

I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location.
Ex:

mainfolder1
file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure.
rsync is not working
# 2  
Old 05-23-2014
What have you tried
# 3  
Old 05-23-2014
This seems ideal for rsync. Are you getting error from rsync?
Are you trying to only move files that have changed?
More details on what you have done, as SriniShoo has said, would help.
# 4  
Old 05-26-2014
I tried the following

Code:
cp -r /xxx00d10/home/nettest/test2/ /xxx00d10/home/testexp1/test1/


it is copying all the files to the same location..but i want files to be copied to different sub directories with different path

---------- Post updated at 10:37 AM ---------- Previous update was at 10:30 AM ----------

i got rsync command not found . i searched for the rsync file in /etc location , it was not found in configuration files.

Last edited by Franklin52; 05-26-2014 at 05:09 AM.. Reason: Please use code tags
# 5  
Old 05-27-2014
Look in either /usr/bin/rsync or /bin/rsync.

Code:
$ which rsync
/usr/bin/rsync

I would use:

Code:
/bin/rsync -av /xxx00d10/home/nettest/test2/* /xxx00d10/home/testexp1/test1

# 6  
Old 05-28-2014
Rsync file is not located in both the places you mentioed.. I am still getting rsync not found command
# 7  
Old 06-10-2014
rsync -av is not overwriting the files in destination
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to move the files older than x days with similar directory structure?

Hello, I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure. for example: /XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt I know about find /XYZ -type f -mtime +14... (3 Replies)
Discussion started by: prvnrk
3 Replies

2. Shell Programming and Scripting

Help with copying the list of files from one location to other location

A) I would like to achive following actions using shell script. can someone help me with writing the shell script 1) Go to some dir ( say /xyz/logs ) and then perform find operation in this dir and list of subdir using find . -name "*" -print | xargs grep -li 1367A49001CP0162 >... (1 Reply)
Discussion started by: GG2
1 Replies

3. Programming

Copying folders from one location to another..

Hi all, I need a suggestion in the following case, I have folder1, folder2 ,folder3 and file1 inside /home/test/source .. I need to copy all the folders and files to another location /home/test/destination Pls suggest any way to program this in C++.. :confused: (1 Reply)
Discussion started by: selvarajvs
1 Replies

4. Shell Programming and Scripting

Copying files to new dir structure.

I am trying to figure out a way to script copying specific files from one dir structure to another. I have a dir structure like this: dira/author 1/book 1/file a.epub /book 2/file b.epub /author 2/book 1/file c.epub /author 3/book 1/file d.epub /book 2/file... (2 Replies)
Discussion started by: arcanas
2 Replies

5. Shell Programming and Scripting

Help with parsing mailbox folder list (identify similar folders)

List sample: user/xxx/Archives/2010 user/xxx/BLARG user/xxx/BlArG user/xxx/Burton user/xxx/DAY user/yyy/Trainees/Nutrition interns user/yyy/Trainees/Primary Care user/yyy/Trainees/Psychiatric NP interns user/yyy/Trainees/Psychiatric residents user/yyy/Trainees/Psychology... (4 Replies)
Discussion started by: spacegoose
4 Replies

6. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies

7. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

8. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

9. UNIX for Dummies Questions & Answers

Copying multiple folders to local machine (don't know folder names)

Hi. I'm trying to copy multiple folders from the remote machine to the local machine. I wrote a batch file to run an ftp window. The problem I am having is that the only command to copy files is mget *, and this copies only files, not folders. For example, ftp ts555 cd ts555/test ' test... (5 Replies)
Discussion started by: leenyburger
5 Replies
Login or Register to Ask a Question