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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete File on FTp Site 1

Status
Not open for further replies.
Mar 12, 2003
678
US
Does any one have the general code using the ActiveX script task to delete a file from an FTP site?
 
This is what we do to delete files from an FTP site:

First write a script file using ActiveX:
Code:
'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************

Function Main()
	Dim oFSO,  oFile

'************************************************************************
' 	Delete file from FTP server.  
'************************************************************************
	set oFSO = CreateObject("Scripting.FileSystemObject")
	set oFile = oFSO.CreateTextFile("c:\ftp_remove_file.txt", true)
	oFile.writeline "lcd c:\"
	oFile.writeline "open xxx.xxx.x.xx"
	oFile.writeline "login_name"
	oFile.writeline "password"
	oFile.writeline "cd /download"
	oFile.writeline "del somefile.txt" 
	oFile.writeline "quit"
	oFile.Close
	set oFile = nothing
	set oFSO = nothing

	Main = DTSTaskExecResult_Success
End Function

Then use an Execute Process task to run the script:
Code:
Win32 process:  ftp.exe
Parameters:	-i -s:c:\ftp_remove_file.txt

I hope that helps! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top