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?
views:
40answers:
4
A:
wget is not the command you are lookin for. you can use ftp command instead. here is a large documentation about this;
WhoSayIn
2010-09-03 18:40:07
A:
If you need to script some operation on a FTP server, I would point you to lftp.
Venza
2010-09-03 20:03:27
+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
2010-09-03 21:13:37
This FTP batch is what I need.
Kay
2010-09-05 07:47:01