views:

40

answers:

4

I can download files using wget "ftp://user:pass@host/prefix*, but I cannot remove downloaded files from FTP. Any easy solution to do this in bash script?

A: 

You want to use ftp for that.

Skilldrick
A: 

wget is not the command you are lookin for. you can use ftp command instead. here is a large documentation about this;

http://linux.about.com/od/commands/l/blcmdl1_ftp.htm

WhoSayIn
A: 

If you need to script some operation on a FTP server, I would point you to lftp.

Main website

Tutorial

Venza
+1  A: 

As WhoSayln and Skilldrick said, you should use ftp to download files, and remove files from the server (if you have the permission to).

But in your question you're saying "I cannot remove downloaded files from FTP". Do you want to remove the local files from your computer (the ones you just downloaded from ftp server) or the files on remote server?

If is local, then just a rm -f file will do it :p

But if it's remote, and this is running on a script (a typical job in a batch) so try something like:

jyzuz@dev:/jean> ftp -n -i remoteserver.com << EOF
> user $username $password
> cd /remote/directory/
> rm filename.txt
> bye
> EOF

More or less? =P

jyzuz
This FTP batch is what I need.
Kay