Copy Directories with Files from One Server to Other using sftp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy Directories with Files from One Server to Other using sftp
# 1  
Old 09-02-2014
Copy Directories with Files from One Server to Other using sftp

Hi,
I have a requirement where I have to connect to another server and copy directories from one server to another

Directories on the Source server look like below (YYYY-MM-DD- 1 to 23)


drwxr-xr-x 2 test_user dmfmart 422 Sep 1 23:45 2014-09-01-18drwxr-xr-x 2 test_user dmfmart 422 Sep 1 23:46 2014-09-01-19drwxr-xr-x 2 test_user dmfmart 422 Sep 1 23:47 2014-09-01-20
I have to connect to the destination server and create a directory in YYYY-MM-DD format and copy all directories from source server (YYYY-MM-DD- 1 to 23) to the destinaton server into the YYYY-MM-DD folder which was just created.

I have tried a few options but not able to get the desired results. COuld you please help
# 2  
Old 09-02-2014
Moderator's Comments:
Mod Comment This duplicate thread is closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy files in respective directories

Hi Guys, I need to copy the files to respective directories based on name of the file. My script is something like below con=$1 for file in `cat $con` do file_tmp=$(ls -t1 $path| grep -i $file | head -n 1) echo $file_tmp if then cp $path$file_tmp $DIR/ap if then... (16 Replies)
Discussion started by: Master_Mind
16 Replies

2. Shell Programming and Scripting

create more than 100 directories and copy files into them

Hi, I have several files containing experiment measurements per hour (hour_1.txt has measurements for first hour, etc..etc..). I have 720 of these files (i.e. up to hour_720.txt) and i want to create 720 directories and in every one of them i want to copy its associative file (e.g.... (4 Replies)
Discussion started by: amarn
4 Replies

3. UNIX for Dummies Questions & Answers

how can i copy those files into other directories have the same name

how can i copy those files into other directories have the same name but different in the end i have files in directory called test: 10_10_asdadfsdfad.txt 10_10_11_asdawqefwkjasd.txt 10_10_11_12_asdafjjhoqwd.txt i want to put them in exist directory thart i have on my system i have... (1 Reply)
Discussion started by: t17
1 Replies

4. UNIX for Dummies Questions & Answers

Moving files between directories using SFTP

I want to connect to an SFTP server, GET some files, then move those files to a different directory on the SFTP server so I don't try to GET them next time. But there doesn't seem to be a way to move files between directories on the remote server from SFTP. I missing something obvious? And if... (6 Replies)
Discussion started by: cjhancock
6 Replies

5. UNIX for Dummies Questions & Answers

Compare two directories and copy differing files

Hello there, I'm a total noob to shell scripting. :) What I want to do is compare the contents of Folder A and Folder B, and copy any files in Folder A that do not exist in Folder B over to Folder B. I have gotten so far as: diff -rq folderA folderB which returns the names of the files,... (3 Replies)
Discussion started by: raaaaaa
3 Replies

6. UNIX for Dummies Questions & Answers

Copy Directories excluding files

Hi guys, I want to copy folder and sub folders only. I don't want the files. If i use cp -r command it will copy entirely with files. Could any one suggest me. Thanks in advance (1 Reply)
Discussion started by: karthik82
1 Replies

7. Shell Programming and Scripting

Copy unique files between two directories in Solaris

Hi, My requirement is to have a shell script: SOURCE_DIR=/usr/logs/restore/ --> Contains multiple subdirectories TARGET_DIR=/usr/data/logs --> Existing folders which contain similar subdirectories I want to copy only newer or uniquie files which are present in $SOURCE_DIR and its... (2 Replies)
Discussion started by: sujoy101
2 Replies

8. UNIX for Dummies Questions & Answers

copy multiple files in different directories

I have a report file that is generated every day by a scheduled process. Each day the file is written to a directory named .../blah_blah/Y07/MM-DD-YY/reportmmddyy.tab I want to copy all of this reports to a separate directory without having to do it one by one. However, if I try cp... (3 Replies)
Discussion started by: ken2834
3 Replies

9. UNIX for Dummies Questions & Answers

How do copy certain files and directories from one hard drive to another?

I have two drives (scsi) mounted on one server and I need to copy certain files and directories from one drive to the other. Any suggestions :confused: (4 Replies)
Discussion started by: shorty
4 Replies

10. AIX

Copy Directories in to UNIX server

I have software on Z drive " I map it " , its about 50 MB , I want to copy the whole directory in to unix server , under some folder ... What are the steps how Ican perform this ? I have UNIX user name and password and rights to create files and folders.. Remember I want to copy all the folder... (3 Replies)
Discussion started by: khan1978
3 Replies
Login or Register to Ask a Question