Help with get/mget from FTP server with files older than 10 minutes

Hi! I am new to unix and this forum as well..
Can someone please help me :

I want to "get/mget" files which are older than 10 minutes from a remote FTP server like "ftp.com".
After getting the files to local unix server say "Prod.com" , i need to delete only those files from ftp.com which got copied to local unix server.

The files in the FTP server (ftp.com) will be coming in below format:

FileName FileSize FileType Last Modified

abc.pkg 102,272 PKG File 12/17/2012 2:46:00 PM
xyz.pkg 98,546 PKG File 12/17/2012 1:46:00 PM
mno.pkg 14,656 PKG File 12/17/2012 1:05:00 PM

Check your find command manual and verify if it supports -mmin option. If yes, then you can use find, ssh & sftp to perform file transfer:-

  1. Create an SFTP batch file using ssh (ssh-key needs to be configured):-
ssh ftp.com "find -mmin +10 | sed 's/\.\///g'" | awk ' { print "get " $0 } ' > sftp_batch.cntrl
  1. Run the SFTP batch file using sftp (ssh-key needs to be configured):-
sftp -b sftp_batch.cntrl ftp.com

No, sftp is not supported for us :frowning:

I have my code like this:

 cmdINPUT=$tempdir/ftpinput
 rm -f $cmdINPUT
 echo "user $FTPID $FTPPWD " > $cmdINPUT
 echo "pwd "                                    >> $cmdINPUT
 echo "cd xxx"              >> $cmdINPUT
 echo "mget *.pkg"                      >> $cmdINPUT
 echo "cd xxx/Backup "    >> $cmdINPUT
 echo "mput *.pkg"                             >> $cmdINPUT
 echo "cd .. "                                  >> $cmdINPUT
 echo "mdelete *.pkg"                  >> $cmdINPUT
 echo "bye "                                    >> $cmdINPUT
 echo "quit"                                    >> $cmdINPUT
 echo "Connecting to $remotehost"  >> $log 
 ftp -vdni $remotehost < $cmdINPUT >> $downloadlog 2>$downloaderrorlog

how to change it to get/mget only files older than 10 minutes from remote host (ftp.com) and also delete only those files from remote host after copying.

Please always use code tags when posting any code fragments or data samples. If you are not sure how to use code tags, then please have a look at this forum video tutorial

BTW I don't think there is any way to do this inside FTP. You have to generate the list of files older than 10 minutes outside FTP and use it.

Yes, thats what i was looking for. If someone can help me with it.