If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
scheduling ftp
Hi,
I found this article in the knowledge base and the steps it describes work perfectly to create an ftp script which I can schedule to run daily in the Scheduled Tasks. http://support.microsoft.com/kb/96269 Unfortunately, the file I need to download has a different filename every day. It always contains yesterdays date as part of the file name. Is there a way to define a variable for yesterday's date, to prompt for the filename, or to download all the files posted yesterday regardless of filename? Anything not requiring user input would be preferred so it can remain an automated task. Thanks |
Ads |
#2
|
|||
|
|||
scheduling ftp
"Dektolia" wrote in message ... Hi, I found this article in the knowledge base and the steps it describes work perfectly to create an ftp script which I can schedule to run daily in the Scheduled Tasks. http://support.microsoft.com/kb/96269 Unfortunately, the file I need to download has a different filename every day. It always contains yesterdays date as part of the file name. Is there a way to define a variable for yesterday's date, to prompt for the filename, or to download all the files posted yesterday regardless of filename? Anything not requiring user input would be preferred so it can remain an automated task. Thanks The following .vbs script will return yesterday's date: MyDate = DateAdd("d", date(), -1) wscript.echo Year(MyDate) & pad(Month(MyDate)) & pad(Day(MyDate)) Function Pad (n) Pad = right("0" & n, 2) End Function Unfortunately you left out several essential details, e.g. - In what order is the date reflected in your file names? - What delimiters (if any) are used between year, month and day? - Are numbers below 10 shown with or without leading 0s? Posting your ftp script might also be an excellent idea unless you're happy to wrap it up yourself. |
#3
|
|||
|
|||
scheduling ftp
Hi,
I used the knowledge base article to create an ftp script called test.scr which works to transfer static filenames when I type 'ftp -s:test.scr' at a command prompt (or, more imporantly, in windows scheduler). Unfortunately, in the ftp script I'm limited to ftp commands and it ends up putting all commands at an ftp prompt when I try to set variables. Is there a way to pass the ftp script a variable so that I could use another executable to create the variable filename and then call on the ftp script to use the variable filename. The date is in mmddyy format with leading zeros but no delimiters. Here is the contents of the very simple ftp script (test.scr): open ftpservername user password lcd NewLocalDirectory get File120708.txt.pgp quit "Pegasus (MVP)" wrote: "Dektolia" wrote in message ... Hi, I found this article in the knowledge base and the steps it describes work perfectly to create an ftp script which I can schedule to run daily in the Scheduled Tasks. http://support.microsoft.com/kb/96269 Unfortunately, the file I need to download has a different filename every day. It always contains yesterdays date as part of the file name. Is there a way to define a variable for yesterday's date, to prompt for the filename, or to download all the files posted yesterday regardless of filename? Anything not requiring user input would be preferred so it can remain an automated task. Thanks The following .vbs script will return yesterday's date: MyDate = DateAdd("d", date(), -1) wscript.echo Year(MyDate) & pad(Month(MyDate)) & pad(Day(MyDate)) Function Pad (n) Pad = right("0" & n, 2) End Function Unfortunately you left out several essential details, e.g. - In what order is the date reflected in your file names? - What delimiters (if any) are used between year, month and day? - Are numbers below 10 shown with or without leading 0s? Posting your ftp script might also be an excellent idea unless you're happy to wrap it up yourself. |
#4
|
|||
|
|||
scheduling ftp
Due to the variable limitations with ftp it may be easier for me to copy all
the files to a temporary directory on my local machine (which I can do by changing the get command below to mget *.txt.pgp) and then using another type of script or batch file to move only the files with yesterday's date in the name to the directory I want them to end up in. This removes the ftp portion of the challenge. If there's an easier way to do it please let me know. Thanks "Dektolia" wrote: Hi, I used the knowledge base article to create an ftp script called test.scr which works to transfer static filenames when I type 'ftp -s:test.scr' at a command prompt (or, more imporantly, in windows scheduler). Unfortunately, in the ftp script I'm limited to ftp commands and it ends up putting all commands at an ftp prompt when I try to set variables. Is there a way to pass the ftp script a variable so that I could use another executable to create the variable filename and then call on the ftp script to use the variable filename. The date is in mmddyy format with leading zeros but no delimiters. Here is the contents of the very simple ftp script (test.scr): open ftpservername user password lcd NewLocalDirectory get File120708.txt.pgp quit "Pegasus (MVP)" wrote: "Dektolia" wrote in message ... Hi, I found this article in the knowledge base and the steps it describes work perfectly to create an ftp script which I can schedule to run daily in the Scheduled Tasks. http://support.microsoft.com/kb/96269 Unfortunately, the file I need to download has a different filename every day. It always contains yesterdays date as part of the file name. Is there a way to define a variable for yesterday's date, to prompt for the filename, or to download all the files posted yesterday regardless of filename? Anything not requiring user input would be preferred so it can remain an automated task. Thanks The following .vbs script will return yesterday's date: MyDate = DateAdd("d", date(), -1) wscript.echo Year(MyDate) & pad(Month(MyDate)) & pad(Day(MyDate)) Function Pad (n) Pad = right("0" & n, 2) End Function Unfortunately you left out several essential details, e.g. - In what order is the date reflected in your file names? - What delimiters (if any) are used between year, month and day? - Are numbers below 10 shown with or without leading 0s? Posting your ftp script might also be an excellent idea unless you're happy to wrap it up yourself. |
#5
|
|||
|
|||
scheduling ftp
The FTP command is sufficiently flexible to let you set or change just about
everything. Try this batch file: @echo off set site=ftp.dektolia.com set user=dektolia set password=SomePassword set script=c:\script.scr set VBS=c:\script.vbs echo %VBS% MyD = DateAdd("d", date(), -1) echo%VBS% wscript.echo p(Month(MyD)) ^& p(Day(MyD)) ^& p(Year(MyD)) echo%VBS% Function P(n) echo%VBS% P = right("0" ^& n, 2) echo%VBS% End Function for /F %%a in ('cscript //nologo %VBS%') do set Yesterday=%%a echo %script% %user% echo%script% %password% echo%script% binary echo%script% get File%Yesterday%.txt.pgp echo%script% quit ftp -s:%Script% %site% del %VBS% del %script% Change the first three "set" commands to reflect your environment. Do not retype the batch file - use copy & paste instead. "Dektolia" wrote in message ... Hi, I used the knowledge base article to create an ftp script called test.scr which works to transfer static filenames when I type 'ftp -s:test.scr' at a command prompt (or, more imporantly, in windows scheduler). Unfortunately, in the ftp script I'm limited to ftp commands and it ends up putting all commands at an ftp prompt when I try to set variables. Is there a way to pass the ftp script a variable so that I could use another executable to create the variable filename and then call on the ftp script to use the variable filename. The date is in mmddyy format with leading zeros but no delimiters. Here is the contents of the very simple ftp script (test.scr): open ftpservername user password lcd NewLocalDirectory get File120708.txt.pgp quit "Pegasus (MVP)" wrote: "Dektolia" wrote in message ... Hi, I found this article in the knowledge base and the steps it describes work perfectly to create an ftp script which I can schedule to run daily in the Scheduled Tasks. http://support.microsoft.com/kb/96269 Unfortunately, the file I need to download has a different filename every day. It always contains yesterdays date as part of the file name. Is there a way to define a variable for yesterday's date, to prompt for the filename, or to download all the files posted yesterday regardless of filename? Anything not requiring user input would be preferred so it can remain an automated task. Thanks The following .vbs script will return yesterday's date: MyDate = DateAdd("d", date(), -1) wscript.echo Year(MyDate) & pad(Month(MyDate)) & pad(Day(MyDate)) Function Pad (n) Pad = right("0" & n, 2) End Function Unfortunately you left out several essential details, e.g. - In what order is the date reflected in your file names? - What delimiters (if any) are used between year, month and day? - Are numbers below 10 shown with or without leading 0s? Posting your ftp script might also be an excellent idea unless you're happy to wrap it up yourself. |
Thread Tools | |
Display Modes | |
|
|