1854708 Members
18904 Online
104102 Solutions
New Discussion

FTPing directories

 
SOLVED
Go to solution
Brian Atkins
Advisor

FTPing directories

I am trying to copy several $HOME directories from an existing 10.20 machine to a new 11.00 machine. The 11.00 box is trusted and will not allow root login or ftp, but the existing server will.
I think my best option is to ftp over from the new machine to the old one, but I am not having any success copying the directories, and continue to get error: NOT A PLAIN TEXT FILE.
4 REPLIES 4
Shane Travis
Frequent Advisor
Solution

Re: FTPing directories

FTP does not allow you to copy directories. Get around this by using 'tar' to create a single file from the entire structure, then ftp that file. Like so:

On the 10.20 box:
% cd /home
% tar -cv home.user1 user1
% tar -cv home.user2 user2
[etc]
Optional step if you have a slow link:
% compress -v /home/home.*

On the 11.00 box:
% cd /home
% ftp -i [10.20 machine name]
Name:
331 Password required for .
Password:
230 User logged in.
Remote system type is UNIX.
ftp> binary
200 Type set to I.
ftp> cd /home
250 CWD command successful.
ftp> mget home.*
[many copying messages]
ftp> bye
% ls -1 home.* | xargs tar -cvf

That should cover your situation.
Shane Travis
Frequent Advisor

Re: FTPing directories

Whoops! That last line should read:

% ls -1 home.* | xargs tar -xvf

Also note that if you used the "compress" command in the first part, you'll need to run

% uncompress /home/home.*.Z

before you try the 'tar -xvf'.
Brian Atkins
Advisor

Re: FTPing directories

EXCELLENT! Thanks!
Tim Malnati
Honored Contributor

Re: FTPing directories

You might want to take a look at rdist functionality. It does require a trust establishment (at least for the duration), but the benefits are worth it. Not only do you maintain modification dates, but rdist is smart enough to maintain ownership and complete permissions if the owner has been defined on the target machine (uid does not need to be the same). Another big plus is the ability to map directories and files to different locations and remotely invoke commands to perform any special processing after it has been copied across. Well worth the time to learn this gem!