How to use any command in FTP ?

Posted by Scurz on Fri 25 Apr 2008 at 12:09

I wanted to use the "find" command on a FTP space but it's not possible to use this command with any "normal" FTP client. So, I looked for a solution.

Therefore, I discovered curlftpfs. with this tool, it is possible to use any command (whose "find"). Great !

Even if the example on the curlftpfs's website is explicit, I'm going to give another fuller example.

# Adapt $USER, $PASSWD & $HOST ;
mkdir /root/tmpftp
curlftpfs ftp://$USER:$PASSWD@$HOST/ /mnt/directory/
And what I wanted to do with "find" :
# Adapt $USER, $PASSWD & $HOST ;
mkdir /root/tmpftp
curlftpfs ftp://$USER:$PASSWD@$HOST/ /root/tmpftp/

# To remove all files which are older than 5 days.
cd /root/tmpftp
find ./ -mtime +5 -exec rm -f {} \;

This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):

This article is copyright 2008 Scurz - please ask for permission to republish or translate.