IIS FTP Server - FTP delete problem

This is Interesting: Free IT Magazines  
Home > Archive > IIS FTP Server > August 2006 > FTP delete problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FTP delete problem
fabio

2006-07-08, 7:25 am

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.


Bernard Cheah [MVP]

2006-07-10, 1:26 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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:OZ7S6ZloGHA.4912@TK2MSFTNGP05.phx.gbl...
>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.
>



fabio

2006-07-10, 7:22 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...
> 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@virgilio.it> wrote in message
> news:OZ7S6ZloGHA.4912@TK2MSFTNGP05.phx.gbl...
>
>



Bernard Cheah [MVP]

2006-07-10, 7:22 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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:%23G6x1t%23oGHA.1440@TK2MSFTNGP03.phx.gbl...
> 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...
>
>



Fabio

2006-07-10, 1:18 pm

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:
[vbcol=seagreen]
> 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@virgilio.it> wrote in message
> news:%23G6x1t%23oGHA.1440@TK2MSFTNGP03.phx.gbl...

fabio

2006-07-12, 1:26 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...
> 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:
>
>



Bernard Cheah [MVP]

2006-07-13, 1:23 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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:ubIrWNXpGHA.3584@TK2MSFTNGP05.phx.gbl...
> 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...
>
>



fabio

2006-07-13, 7:27 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...
> 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/
>
>
> "fabio" <fabio.cecaro@virgilio.it> wrote in message
> news:ubIrWNXpGHA.3584@TK2MSFTNGP05.phx.gbl...
>
>



Bernard Cheah [MVP]

2006-07-13, 7:27 am

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

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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:O7axEakpGHA.1600@TK2MSFTNGP04.phx.gbl...
> 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...
>
>



fabio

2006-07-15, 7:23 am

The Output
*****************************
ftp> Connected to 10.10.20.50.

open 10.10.20.50
220 Microsoft FTP Service
User (10.10.20.50none)):
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...
>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
> 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/
>
>
> "fabio" <fabio.cecaro@virgilio.it> wrote in message
> news:O7axEakpGHA.1600@TK2MSFTNGP04.phx.gbl...
>
>



Bernard Cheah [MVP]

2006-07-16, 7:26 am

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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:%23kLmJQAqGHA.3584@TK2MSFTNGP03.phx.gbl...
> The Output
> *****************************
> ftp> Connected to 10.10.20.50.
>
> open 10.10.20.50
> 220 Microsoft FTP Service
> User (10.10.20.50none)):
> 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...
>
>



fabio

2006-07-18, 7:27 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...
> 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/
>
>
> "fabio" <fabio.cecaro@virgilio.it> wrote in message
> news:%23kLmJQAqGHA.3584@TK2MSFTNGP03.phx.gbl...
>
>



Bernard Cheah [MVP]

2006-07-22, 7:37 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/


"fabio" <fabio.cecaro@virgilio.it> wrote in message
news:eaGQ7GjqGHA.2180@TK2MSFTNGP05.phx.gbl...
> 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...
>
>



Fabio

2006-07-26, 1:25 pm

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:
[vbcol=seagreen]
> 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/
>
>
> "fabio" <fabio.cecaro@virgilio.it> wrote in message
> news:eaGQ7GjqGHA.2180@TK2MSFTNGP05.phx.gbl...

Bernard Cheah [MVP]

2006-07-27, 1:26 pm

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/


"Fabio" <fabio.cecaro@virgilio.it> wrote in message
news:1153916251.965327.311950@m73g2000cwd.googlegroups.com...
>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:
>
>



Fabio

2006-07-27, 1:26 pm

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:
[vbcol=seagreen]
> 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/
>
>
> "Fabio" <fabio.cecaro@virgilio.it> wrote in message
> news:1153916251.965327.311950@m73g2000cwd.googlegroups.com...

Bernard Cheah [MVP]

2006-07-28, 7:26 am

Yeah! yeah! thanks for the update.
so 'timing' is the key here

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


"Fabio" <fabio.cecaro@virgilio.it> wrote in message
news:1153995639.379150.39050@m73g2000cwd.googlegroups.com...
> 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:
>
>



Jeo LI

2006-08-11, 7:30 pm



Well, I think it a scheduler problem, I ran the same scirp manually it
work but when i go into scheduler and right click and run it saids
goodbye.

*** Sent via Developersdex http://www.codecomments.com ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com