Copying Directories from one server to another


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copying Directories from one server to another
# 1  
Old 09-02-2014
Copying Directories from one server to another

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)
Code:
drwxr-xr-x   2 test_user  dmfmart     422 Sep  1 23:45 2014-09-01-18
drwxr-xr-x   2 test_user  dmfmart     422 Sep  1 23:46 2014-09-01-19
drwxr-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 the below and see these errors:
Code:
put *
Couldn't read from "2014-09-01-18": Is a directory

get -r *
Invalid flag -r

lmkdir

Not throwing any error but not creating a new directory on the remote server as well.

Thanks in Advance!

Last edited by vbe; 09-02-2014 at 05:19 AM.. Reason: code tags
# 2  
Old 09-02-2014
put is not a unix command (shell ) command and get for me is a SCCS command so will not work...
Unless you are talkings of FTP (which you have not mentionned! ) and in which case both commands are for ONE file, for multiple you have mput,mget commands for ftp, read again the man pages of ftp.
Why arent you using sftp, or scp?
# 3  
Old 09-02-2014
Quote:
Originally Posted by vbe
read again the man pages of ftp.
Exactly!

Quote:
Originally Posted by vbe
Why arent you using sftp, or scp?
or use tar to stuff the whole tree to a single file, transfer that and untar it on the other side. This will preserve all the user information, filemodes, etc.. and might be, depending on your exact requirements (of which you gave us only a cursory impression) less effort.

I hope this helps.

bakunin
# 4  
Old 09-03-2014
If your folder contains subfolders and more importantly symlinks you should use rsync

Code:
rsync -aruv localfolder/ user@server:destination/

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying files to directories based on first 6 character

guys, i did create a script but its too long, though it function the same. # cat nightlyscan.sh #!/usr/ksh deyt=`date +"%Y-%m-%d"` for i in `ls -lrt|grep $deyt|awk '{print $9}'` do cp -f $i /S1/Sophos/logger/ done # but i did not paste it all. this is the desired. (9 Replies)
Discussion started by: kenshinhimura
9 Replies

2. Shell Programming and Scripting

Error check for copying growing directories

I have a simple script which copies directory from one place to another and deleting the source . I am facing a situation when new files gets added when the script has started running. Its resulting in data loss Please suggest a way to avoid data loss. I googled a lot but most are perl... (11 Replies)
Discussion started by: ningy
11 Replies

3. Shell Programming and Scripting

Copying data from files to directories

I have the following that I'd like to do: 1. I have split a file into separate files that I placed into the /tmp directory. These files are named F1 F2 F3 F4. 2. In addition, I have several directories which are alphabetized as dira dirb dirc dird. 3. I'd like to be able to copy F1 F2 F3 F4... (2 Replies)
Discussion started by: newbie2010
2 Replies

4. Shell Programming and Scripting

Copying all directories while ignoring certain filetypes

I want to write a script that copys over a complete folder including the dirs to another location. However in the process I want to ignore several filetypse that SHOULD NOT get copied over. I know Global Ignore is capable of make the copy command ignore one file type, however I don't know how... (8 Replies)
Discussion started by: pasc
8 Replies

5. Shell Programming and Scripting

Copying a files from a filter list and creating their associated parent directories

Hello all, I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Discussion started by: hunter55
4 Replies

6. Shell Programming and Scripting

Backup script: Copying and removing directories based on list

I am writing a simple backup script, but I cannot figure out how to remove directories that are found in a list. For example: DONT_COPY=" .adobe/ .bin/google-earth " tar -zcvf - * --exclude=$DONT_COPY | openssl des3 -salt -k $1 | dd of=$(hostname)-$(date +%Y%m%d).tbz > COPIED Note that... (4 Replies)
Discussion started by: dotancohen
4 Replies

7. UNIX for Dummies Questions & Answers

Using find -d and copying to the found directories

Hi again All :) After posting my first thread just a few eeks ago and having such a great response (Thank You once again :) ), I thought I'd perhaps ask the experts again. In short I'm trying to achieve a "find" and "copy" where the find needs to find directories: find -d -name outbox and... (6 Replies)
Discussion started by: Dean Rotherham
6 Replies

8. UNIX for Dummies Questions & Answers

copying directories from NT server to Unix server (solaris 5.8)

I need to copy around 30 directories (each directory include one or more text file(s)) from NT server to Unix server at one go. For doing this what are the privillages i should have in both NT and Unix server. Please let me know which command i can use in shell prompt. TIA. (4 Replies)
Discussion started by: jhmr7
4 Replies

9. UNIX for Dummies Questions & Answers

copying to multiple directories using wildcard

Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me cp /tmp/a.kool /tmp/folder/*/keys/ I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ? (4 Replies)
Discussion started by: logic0
4 Replies

10. UNIX for Dummies Questions & Answers

Copying multiple directories at the same time using Unix

Another Unix question. How would I copy multiple directories at the same time? Right now I do: cp -r -f /directory1/ ../backup/directory1/ I do that for each directory one at a time. But there are multiple directories I'd like to copy. So instead of sitting there and doing one at a time, is... (9 Replies)
Discussion started by: JPigford
9 Replies
Login or Register to Ask a Question