You are not logged in.

#1 2012-09-03 19:32:18

kdar
Member
From: Alabama!!!
Registered: 2009-06-27
Posts: 353

redirecting get command inside ftp client?

Is it possible to redirect get command inside ftp client?

I was only able to do "get filename /dev/null" to redirect it to /dev/null.. However.. what if I want to redirect it to a compression or decompression utility?

Example of ftp script I used:

#!/bin/bash
HOST='server-ip'
USER='username'
PASSWD='password'
FILE=$1
ftp -i -n $HOST <<END_SCRIPT
user ${USER} ${PASSWD}
binary
get $FILE
quit
END_SCRIPT
exit 0

The file I am trying to get is a compressed file, I would like to pipe it into decompression utility like gunzip.

Last edited by kdar (2012-09-03 19:33:52)

Offline

#2 2012-09-03 21:32:21

kdar
Member
From: Alabama!!!
Registered: 2009-06-27
Posts: 353

Re: redirecting get command inside ftp client?

Solved it. I found that I could access ftp server with wget as well, and redirect it's output to another utility:

time wget --user=username --password=password -qO - ftp://serverName/file.gz | gunzip -cf > /dev/null

Last edited by kdar (2012-09-03 21:32:47)

Offline

Board footer

Powered by FluxBB