Right now we have a script that uses the FTP mget command to download all the files in a specific location. After after verifying the files have successfully downloaded we run a ftp delete command to delete each file that was downloaded. We noticed that each ftp delete is creating a new connection and I was wondering if it is possible to delete each file in one connection? I have a .txt file with all the file names that need to be deleted, but the file type varies a great deal so it would be nice to be able to target each file individually.

  • 1
    Your ftp client may have an mdelete command. – Mark Plotnick Jun 18 '15 at 16:41

You might use lftp instead of the regular ftp client. With lftp you can use mget -E /path/to/files which will delete the source files after succesful transfer.

See http://lftp.yar.ru/lftp-man.html for the manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.