LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   SCP copying directories between servers (https://www.linuxquestions.org/questions/linux-software-2/scp-copying-directories-between-servers-492007/)

astrollama 10-13-2006 02:26 AM

SCP copying directories between servers
 
I have an SCP query like this(its on the same server but different port):

scp -r /path/xml_documents_content/ ip_address:/path/xml_documents

What it does is copy everything from xml_documents_content into xml_documents folder on target, BUT it creates a new folder xml_documents_content under the/xml_documents folder, and I just want the files to go straight into the xml_documents folder.

Any help? Please?

MasterC 10-13-2006 02:32 AM

rsync instead? Other than that, does a .* help?
scp -r /path/to/files/.* ip:/path/to/files

Cool

astrollama 10-13-2006 02:47 AM

Quote:

Originally Posted by MasterC
rsync instead? Other than that, does a .* help?
scp -r /path/to/files/.* ip:/path/to/files

Cool

I tried
scp -r /path/xml_documents_content/* ip_address:/path/xml_documents
but then I got errors, as Ive got a heap of directories under xml_documents_content
and got errors like '61414' is not a regular file

MasterC 10-13-2006 02:53 AM

Is rsync a bad (or unavailable) option?

Cool

astrollama 10-13-2006 02:59 AM

Quote:

Originally Posted by MasterC
Is rsync a bad (or unavailable) option?

Cool

To be honest, it could be an option. The person a bit higher up than me in my job told me to use scp, and I put to them the rsync option and they said they've never used it before.
Could you perhaps give me an example of how I'd do the rsync?

MasterC 10-13-2006 03:10 AM

Sure, I'll show you what I use, and then point you to the document describing how to do what I use:
Code:

* * * * 1 rsync -e ssh -avz user@example.com:/path/to/files/ /path/to/backup/ 2>&1 /var/log/weekly-backup.log
I set that cronjob (notice the * * * ) on the machine doing the backup, not the server where the files actually live and are served from (it's a website backup job). So, the docs:
http://www.linuxquestions.org/linux/...etween_servers
and then to have the public key arrangement to automate this process in cron (also linked in the above document):
http://www.linuxquestions.org/linux/...ation_with_ssh

HTH

Cool


All times are GMT -5. The time now is 05:13 AM.