1748117 Members
3718 Online
108758 Solutions
New Discussion юеВ

Re: Need FTP scripts

 
SOLVED
Go to solution
vthiru
Advisor

Need FTP scripts

Hello Admins,

I would like to ftp about 40GB of data from my server to ftp server. There are lots and lots of folders, sub folders and files present. Tried to ftp, but it is not sending directories. There is no space left in the drive to compress the parent directory and ftp it. Please help me with scripts to automate the ftp.

Any Help is greatly appreciated.

Thanks,
vthiru
13 REPLIES 13
Rasheed Tamton
Honored Contributor

Re: Need FTP scripts

Hello Vthiru,

You could use tar with gzip and it will produce a tar archive file. You can ftp/rcp that archive to the destination system and extract it from there.

Regards,
Rasheed Tamton.
Rasheed Tamton
Honored Contributor

Re: Need FTP scripts

>There is no space left in the drive to compress the parent directory and ftp it.

In that case, you could copy the compressed file to another mountpoint where there is enough space.

tar cvf - ./home/vthiru/test |gzip - > /tmp/test.tgz

ftp test.tgz to the destination server

gzip -dc test.tgz |tar -tvf -
gzip -dc test.tgz |tar -xvf -



vthiru
Advisor

Re: Need FTP scripts

There is not enough space left in the drive to compress the folder. Space left is less than 1GB.

Thanks,
vthiru
vthiru
Advisor

Re: Need FTP scripts

Thanks for the response. But, there is only one drive present. I don't have choice of compressing the folder to a different mount point. That is the reason I am looking for some FTP scripts to upload file to my ftp server.

Thanks,
vthiru
Rasheed Tamton
Honored Contributor

Re: Need FTP scripts

In that case, is it possible for you to use rcp/scp.
rcp -rp /dirname remotehost:/dirname/

or
if you can get hold of a ftp GUI application you would be able to just drag and drop to the remote-system/dir. as in the Windown Filemanager

Regards.
Rasheed Tamton
Honored Contributor

Re: Need FTP scripts

Also check wget

http://www.gnu.org/software/wget/

Rgds.
Steven E. Protter
Exalted Contributor
Solution

Re: Need FTP scripts

Shalom,

scp -rp * hostname:/directory

This will take subdirectories and put them on the target server.

It is likely that the target system has sshd daemon running, this is a default with Linux.

Also. openssh which includes sftp/ssh/scp is more secure. Authentication and data stream is encrypted. That makes it a little slower though.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Magnus Andersen
Advisor

Re: Need FTP scripts

I too would suggest scp as the best option. If you want to use an ftp client to do it you should be able to use lftp.

HTH,
Magnus
Jimmy Vance
HPE Pro

Re: Need FTP scripts

Another option is to use a combination of netcat and tar.

move data from machine a to machine b

on machine a

change to the directory you want to start from

# tar -cf - . | netcat -w 3 -l -p 5432

on machine b

change to the directory where you want the files to go

# netcat -w 5 a.example.com 5432 | tar -xvf -

The command sets up a tar process on machine a that waits for a tcp connection on port 5432. When a client (machine b) connects, tar simply sends all the data through that tcp port. No temporary files are required. On machine b, another tar process reads from the network via netcat, writing
the data to the disks as it streams over the network


Some flavors of Linux netcat is called nc
No support by private messages. Please ask the forum!