Possible Duplicate:
How to delete the oldest file over FTP using CURL?
I need to connect to a remote server using a bash script and then delete all files within the directory that are older than 7 days. I'm trying to do this with a for loop within the FTP remote server and I get an error.
#!/bin/sh
HOST='www.ftpserver.com'
USER='username'
PASSWD='password'
ftp -n $HOST <<END_SCRIPT
user ${USER} ${PASSWD}
for i in {ls}
do
echo "$i"
done
quit
END_SCRIPT
exit 0
The error I get is
We only support non-print format, sorry.
?Invalid command
?Invalid command
Any pointers will help
lftp -u username,password ftp://server -e "ls"
– charlesbridge Nov 14 '12 at 21:43