Re: FTP delete problem



Here's my code scheduled every day

***********************************
Option Explicit

Dim objFSO, objMyFile, objShell,FileLog
Dim anno, mese,meseN, giorno,Return
Dim d1,strFTPScriptFileName, strFile2Get
Dim strLocalFolderName, strFTPServerName, strLoginID
Dim strPassword, strFTPServerFolder

d1=dateadd("d",-1,date)

anno=Right(year(d1),2)
mese=Trim(month(d1))
if len(mese)<=1 Then
mese="0"&mese
end If
giorno=day(d1)
if len(giorno)<=1 Then
giorno="0"&giorno
end If

FileLog = Trim("ex"&anno&mese&giorno&".log")

strLocalFolderName = "d:\logfiles"
strFTPServerName = "10.10.20.50"
strLoginID = "mylogin"
strPassword = "mypassword"
strFTPServerFolder = "W3SVC1095794977"

Set objFSO = CreateObject("Scripting.FileSystemObject")

strFTPScriptFileName = "C:\Inetpub\wwwroot\stat\FTPScript.txt"

Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)
objMyFile.WriteLine ("open " & strFTPServerName)
objMyFile.WriteLine (strLoginID)
objMyFile.WriteLine (strPassword)
objMyFile.WriteLine ("cd " & strFTPServerFolder)
objMyFile.WriteLine ("ascii")
objMyFile.WriteLine ("lcd " & strLocalFolderName)
objMyFile.WriteLine ("get " & FileLog)
objMyFile.WriteLine ("delete " & FileLog & " > c:\output.txt")
objMyFile.WriteLine ("bye")
objMyFile.Close
Set objMyFile = Nothing

Set objShell = WScript.CreateObject( "WScript.Shell" )
Return = objShell.Run("ftp -s:" & Chr(34) & strFTPScriptFileName & chr(34)
,1,true)

Set objFSO = Nothing
*******************************************************

I have modified the row with delete command, but it's don't write any files.



"Fabio" <fabio.cecaro@xxxxxxxxxxx> ha scritto nel messaggio
news:1152542159.812868.38700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The verbose mode is always on.
I test the output ">" to file, but nothing.

In my script I use the options -s for the file.
The options -d (debugging), how it works?


Bernard Cheah [MVP] ha scritto:

look at the ftp command, turn on verbose mode
then redirect the output to a text file via the '>' method

e.g. c:\>dir *.* > output.txt



--
Regards,
Bernard Cheah
http://www.iis.net/
http://www.iis-resources.com/
http://msmvps.com/blogs/bernard/


"fabio" <fabio.cecaro@xxxxxxxxxxx> wrote in message
news:%23G6x1t%23oGHA.1440@xxxxxxxxxxxxxxxxxxxxxxx
How i can save the output of FTP command?
If i am in session in the server the scheduled script result OK.
But in automated state scheduled the files that i get don't delete.

In my script i make a txt file with a sequence of command :
logon,lcd,get and delete, by wscript.shell.run

In this mode i try to print the output in the other files, but nothing
to
do.

I don't know the error,
the ftp command save the status in temp files that i don't know?

Thanks


"Bernard Cheah [MVP]" <qbernard@xxxxxxxxxxxxxxxxxxx> ha scritto nel
messaggio news:eVTV918oGHA.3288@xxxxxxxxxxxxxxxxxxxxxxx
Strange indeed. was it error 550 in the status code?
Sound like ftp cache issue to me, but it works in manual mode :(

is it always failed to delete the log?

--
Regards,
Bernard Cheah
http://www.iis.net/
http://www.iis-resources.com/
http://msmvps.com/blogs/bernard/


"fabio" <fabio.cecaro@xxxxxxxxxxx> wrote in message
news:OZ7S6ZloGHA.4912@xxxxxxxxxxxxxxxxxxxxxxx
I have made a script in server A that make ftp connection to server B,
Get a file and Delete it after.
Well, in this script i have insert username,password of local account
of
server B
that have read/write/delete access in the directory that i need.
This script is scheduled every day (i download the day before IIS
logfile to another server)
and it Get without problem, but don't Delete log file, strangely if i
run manually this script,
the Delete problem have resolved.
There is problem in windows 2003 ftp server or in the credentials of
script scheduled?
Please Help Me.








.



Relevant Pages

  • Re: VBS to create local user and add to local amins
    ... Notice the commas separating all variables declared in the Dim statement. ... Dim objNetwork strComputer, objComputer, objUser ... Dim strUserName, strPassword, objGroup ... I need the script to create a local user named Temp ...
    (microsoft.public.windows.server.scripting)
  • Re: FTP delete problem
    ... Dim objFSO, objMyFile, objShell,FileLog ... Dim strLocalFolderName, strFTPServerName, strLoginID ... In my script I use the options -s for the file. ... the ftp command save the status in temp files that i don't know? ...
    (microsoft.public.inetserver.iis.ftp)
  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: Password Expire
    ... We have one fron end Edge server in our DMZ which passes email onto two ... I used to schedule a script to run every 24 hours on my Exchange 2003 ... Dim fso, txtarray, BodyText ... Call ProcessFolder (objContainer, numDays) ...
    (microsoft.public.exchange.admin)
  • Re: LDAP query information
    ... a "Dim" statement. ... execution of the script. ... ' Filter on computer object. ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)