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.
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.