Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to move Directories and files between linux systems?

Posted on 2007-12-05
9
Medium Priority
?
1,755 Views
Last Modified: 2013-12-16
Hi,
I am new to Linux administration. I have to transfer a huge directory and its contents from one linux server to another linux manchine. Similar to DOS xcopy command. Please be gentle with me by guiding step by step..;) having a little search i could see many suggestions like SCP, SFTP etc..Dont know whats the common and fast solution to accomplish this.

Thanks for your help
0
Comment
Question by:Basheerpt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 20417775
Depends on if you want to preserve all the ownership/group and permissions.  If not, then a simple

scp -rp /path/to/dir user@remoteserver:/some/path

will work, otherwise you can use rsync, eg:

rsync -e ssh -av /path/to/dir user@remoteserver:/some/path

or

tar cf - /path/to/dir | ssh user@remoteserver "tar xvf -"
0
 
LVL 5

Author Comment

by:Basheerpt
ID: 20417793
Thanks, before i give it a try, pls clarify..

Will the first two commands copy all the contents of the floder and preserve folder structures? (including empty)
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20417845
All three commands will copy everything under the folder (including sub-folders, files etc).
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 5

Author Comment

by:Basheerpt
ID: 20417908
Thanks, I tried the first command to a mounted volume in the target system. Its almost 400 Gb is free there. But, When i try to copy an 80 Gb here, the files started copying after some time gives the error not enough space!

Is there anything have i to do to overcome this?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20417948
Hi,

If you have FTP open between the two m/cs you may use:

wget -r -nH ftp://username:userpassword@remotehostname/dir

The above command to pull files

This is faster in transferring files since it does not involve encryption
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20417999
Please post the exact scp command you used and the output of

df  -h

on the remote system.
0
 
LVL 5

Author Comment

by:Basheerpt
ID: 20418067
df -h
File system                  size                 used              avail            used %           mounted on
/dev/sda5                     20G                  20G                  0                 100                      /
none                             16G                     0                  16G                0                   /dev/shm
/dev/sda8                    480G                 105M              456G              1%                /u01

The command I executed from the source machine:
scp -rp /u01/sourcedir root@192.168.1.2:/u01/destdir

It asked me password in the destination server and it passed. It displayed copying files  after little long, it gives the error. As you can see, my /u01 has plenty of space.

Thanks again
                               
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20418094
Your root file system (/) is full, better to free some logs !
 
0
 
LVL 5

Author Closing Comment

by:Basheerpt
ID: 31678091
When I tried second time, but the same command, it worked perfectly. I used the scp command. But it copied very fast unlike windows! I think i am going to love Linux..;)

Thanks geeks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question