all groups > iis ftp > july 2006 >
You're in the

iis ftp

group:

FTP delete problem


FTP delete problem fabio
7/8/2006 12:00:00 AM
iis ftp:
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.

Re: FTP delete problem Bernard Cheah [MVP]
7/10/2006 12:00:00 AM
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/


[quoted text, click to view]

Re: FTP delete problem fabio
7/10/2006 12:00:00 AM
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@hotmail.com.discuss> ha scritto nel
messaggio news:eVTV918oGHA.3288@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view]

Re: FTP delete problem Bernard Cheah [MVP]
7/10/2006 12:00:00 AM
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/


[quoted text, click to view]

Re: FTP delete problem Fabio
7/10/2006 7:35:59 AM
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:

[quoted text, click to view]
Re: FTP delete problem fabio
7/12/2006 12:00:00 AM
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@virgilio.it> ha scritto nel messaggio
news:1152542159.812868.38700@s13g2000cwa.googlegroups.com...
[quoted text, click to view]

Re: FTP delete problem Bernard Cheah [MVP]
7/13/2006 12:00:00 AM
Ok, you are create the scripts file dynamically.
Can you manually run the script file?
ftp -s:ftpscript.txt

post the output here or you can redirect the output to > abc.txt.

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


[quoted text, click to view]

Re: FTP delete problem fabio
7/13/2006 12:00:00 AM
But i have wrote that manually the delete command it's OK!!!

My problem is in the scheduled phase, when nobody is logged on the server


"Bernard Cheah [MVP]" <qbernard@hotmail.com.discuss> ha scritto nel
messaggio news:OWjS30ipGHA.4760@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

Re: FTP delete problem Bernard Cheah [MVP]
7/13/2006 5:47:41 PM
I know. the task scheduler need permission to fire up the tasks.
Whereas the ftp script - the logon user need to have permissions on the ftp.
If it's works on manually it should work in the scheduled tasks.

I just like to capture the output during manual running the ftp -s:bla bla
[quoted text, click to view]
and inside the scheduel tasks... to see if we can find out anything.

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


[quoted text, click to view]

Re: FTP delete problem fabio
7/15/2006 1:44:44 PM
The Output
*****************************
ftp> Connected to 10.10.20.50.

open 10.10.20.50
220 Microsoft FTP Service
User (10.10.20.50:(none)):
331 Password required for webnascar.

230 User webnascar logged in.
ftp> cd w3svc1424786450
250 CWD command successful.
ftp> ascii
200 Type set to A.
ftp> Local directory now D:\logfiles\mydir
ftp> lcd d:\logfiles\mydir
get ex060714.log
200 PORT command successful.
150 Opening ASCII mode data connection for ex060714.log(5238066464 bytes).
226 Transfer complete.
ftp: 5238066464 bytes received in 495,63Seconds 10568,61Kbytes/sec.

ftp> delete ex060714.log
250 DELE command successful.
ftp> bye
221
****************************************

If i manually execute the script, the output wrote, but by schedule isn't
create the output and the delete
command don't success.

The scheduled task script i configure by admin rights, and the ftp user have
the user right (Read/Write/Modify/Delete) , i think that in windows 2003 the
security is + complex that i know.



"Bernard Cheah [MVP]" <qbernard@hotmail.com.discuss> ha scritto nel
messaggio news:ukQSjFmpGHA.1548@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view]
Re: FTP delete problem Bernard Cheah [MVP]
7/16/2006 5:24:24 PM
You can't capture the output for the schedule task?

Return = objShell.Run("ftp -s:" & Chr(34) & strFTPScriptFileName & chr(34) &
" > output.txt" ,1,true)


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


[quoted text, click to view]
Re: FTP delete problem fabio
7/18/2006 12:00:00 AM
Nothing to do, i try another time this output, but nothing, the file isn't
generate by schedule task.
I think to local policies in case of no session logon, but i don't know the
new security of win2003.
Can you help me?

"Bernard Cheah [MVP]" <qbernard@hotmail.com.discuss> ha scritto nel
messaggio news:e28VimLqGHA.988@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view]
Re: FTP delete problem Bernard Cheah [MVP]
7/22/2006 12:00:00 AM
You mentioned that it logon and download the file. so how would local
policies block it. unless it's not able to login at all.
how come you unable to generate the output from schedule tasks?

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


[quoted text, click to view]
Re: FTP delete problem Fabio
7/26/2006 5:17:32 AM
I have resolved.
the problem was a lock to a file that the ftp get worked, but the ftp
delete did not work.
I get the iis log files in a hour (1:00 AM) when my UTC time zone is
GMT+1 (Rome)
(+1 standard time) = GMT+2.
I had forgotten the flag on the IIS server for the local time zone.
Therefore the log file is locked by iis process.
After to have postponed the scheduled job the problem is disappeared.

Best Regards
FABIO

Bernard Cheah [MVP] ha scritto:

[quoted text, click to view]
Re: FTP delete problem Bernard Cheah [MVP]
7/27/2006 12:00:00 AM
OMG....... so you are trying to delete the 'open' log file.
i thought the script is looking for previous day log ?

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


[quoted text, click to view]
Re: FTP delete problem Fabio
7/27/2006 3:20:39 AM
Yes, the script looking the previous day log file, but when it's still
locked,
two hours after and the problem is resolved.


Bernard Cheah [MVP] ha scritto:

[quoted text, click to view]