Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP - delete file from host after download 1

Status
Not open for further replies.

jwocky

Programmer
Mar 2, 2005
4
US
Hi all
Currently I'm using this ( script to download all files in a directory on my ftp server and it works great. Now I'm was wondering if there's a way to clear out the download directory in the foreign host after the downloads have taken place? Is there a way to use the dele command in aspect? Thanks!
 
You can use the ftp remote delfile <filename> command to delete a file on the remote system, where <filename> is the file (without any path information) as it appears on the FTP site.


 
Thanks for the reply knob. That works great when I know the name of the file thats being downloaded, although a lot of times i don't. Is there a way to delete the file immediately after I download it? like
ftp remote delfile sFileSpec 0

Thanks for your help
 
In the ftp2.was script you are using to download files is this line:

ftp remote copyfile sData

sData will contain the name of the file that is being downloaded. After this code:

while $FTPSTATUS ;Loop while file is being copied
yield
endwhile

you would use the command ftp remote delfile sData to remove the file from the FTP server. You might also want to use a bit of error checking on the local side (such as checking to make sure the file exists) since there is not much error checking available through the FTP operations available through ASPECT.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top