Relatively new (actually brand new) to vbscripting. I've searched the
groups for what I'm looking for but I just cant find it. Basically, I
need a script that can automatically run on windows200serverA FTP into
windows2000serverB and download log files. The log files are created
in a time format like "yyyymmdd.dat". Since I only want complete logs
I would need the script to be able to FTP into the server today and
grab yesterdays file and so on and so on. So if today were Dec 10,
2005 the file that i would need to download would be 20051209.dat (that
would be the file from Dec,9,2005). I wouldnt want the Dec10 file
until Dec11.

I really need to learn vbscript and figure this all out on my own but
time is not on my side on this one. Can anyone assist?

Re: FTP script to download, then delete a file who's name changes based on time. by James

James
Thu Dec 01 10:02:39 CST 2005

"gmedia" <gschaef1@cablevision.com> wrote in message
news:1133449752.703627.134440@g47g2000cwa.googlegroups.com...
> Relatively new (actually brand new) to vbscripting. I've searched the
> groups for what I'm looking for but I just cant find it. Basically, I
> need a script that can automatically run on windows200serverA FTP into
> windows2000serverB and download log files.

Is it an absolute requirement that this be done using FTP? If it can be
done using normal file copy, this could be done with a combination of the
'FileSystemObject' & 'DateDiff'.



Re: FTP script to download, then delete a file who's name changes based on time. by gmedia

gmedia
Thu Dec 01 12:23:11 CST 2005

Not sure how the whole FTP thing began maybe that was they way the
accessed the server. If I can come up with an easier way to do it Im
sure they are open to discussions. This is all pretty new to me. I
wasn't sure which way was the best and the person before me said they
used to run an FTP script locally. I thought I would be able to modify
or edit the existing code but there doesnt appear to be any.


Re: FTP script to download, then delete a file who's name changes based on time. by Angelia

Angelia
Thu Dec 01 21:54:33 CST 2005


James Whitlow wrote:
> "gmedia" <gschaef1@cablevision.com> wrote in message
> news:1133449752.703627.134440@g47g2000cwa.googlegroups.com...
> > Relatively new (actually brand new) to vbscripting. I've searched the
> > groups for what I'm looking for but I just cant find it. Basically, I
> > need a script that can automatically run on windows200serverA FTP into
> > windows2000serverB and download log files.
>
> Is it an absolute requirement that this be done using FTP? If it can be
> done using normal file copy, this could be done with a combination of the
> 'FileSystemObject' & 'DateDiff'.

Is there a way to use the 'FileSystemObject' & 'DateDiff'. on the
server without mapping a drive to it? Different UserIDs and Passwords
than machine it will be running on.


Re: FTP script to download, then delete a file who's name changes based on time. by James

James
Fri Dec 02 17:18:08 CST 2005

"Angelia" <athoward@gmail.com> wrote in message
news:1133495672.995784.53930@o13g2000cwo.googlegroups.com...
> Is there a way to use the 'FileSystemObject' & 'DateDiff'. on the
> server without mapping a drive to it? Different UserIDs and Passwords
> than machine it will be running on.

You can use a UNC path if the credentials of that the script are running
under have permissions to this path. The 'MapNetworkDrive' method supports
user name and password. You can delete the mapping before your script closes
if you don't want to leave the mapping active.



Re: FTP script to download, then delete a file who's name changes based on time. by Steve

Steve
Sat Dec 03 17:34:37 CST 2005

In article <1133461391.335595.195660@g49g2000cwa.googlegroups.com>, Gmedia
wrote:
> Not sure how the whole FTP thing began maybe that was they way the
> accessed the server. If I can come up with an easier way to do it Im
> sure they are open to discussions. This is all pretty new to me. I
> wasn't sure which way was the best and the person before me said they
> used to run an FTP script locally.

Agreed that there are probably better ways of doing this but if you're stuck
with FTP, it's useful to know that every copy of Windows includes FTP.EXE,
which will run from script files.

From a command prompt type FTP -? for help.

It's fairly simple for your own code to write scripts then shell FPT.EXE to run
them.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


Re: FTP script to download, then delete a file who's name changes based on time. by Angelia

Angelia
Mon Dec 05 13:36:22 CST 2005


James Whitlow wrote:
> "Angelia" <athoward@gmail.com> wrote in message
> news:1133495672.995784.53930@o13g2000cwo.googlegroups.com...
> > Is there a way to use the 'FileSystemObject' & 'DateDiff'. on the
> > server without mapping a drive to it? Different UserIDs and Passwords
> > than machine it will be running on.
>
> You can use a UNC path if the credentials of that the script are running
> under have permissions to this path. The 'MapNetworkDrive' method supports
> user name and password. You can delete the mapping before your script closes
> if you don't want to leave the mapping active.

Thanks for your kind reply. My problem is that some people map to the
drive and some don't. I get an error if I attempt to map to the drive
when they have it done already. :-(


Re: FTP script to download, then delete a file who's name changes based on time. by James

James
Mon Dec 05 14:25:44 CST 2005

"Angelia" <athoward@gmail.com> wrote in message
news:1133811382.169432.261940@z14g2000cwz.googlegroups.com...
>
> James Whitlow wrote:
> > "Angelia" <athoward@gmail.com> wrote in message
> > news:1133495672.995784.53930@o13g2000cwo.googlegroups.com...
> > > Is there a way to use the 'FileSystemObject' & 'DateDiff'. on the
> > > server without mapping a drive to it? Different UserIDs and Passwords
> > > than machine it will be running on.
> >
> > You can use a UNC path if the credentials of that the script are
running
> > under have permissions to this path. The 'MapNetworkDrive' method
supports
> > user name and password. You can delete the mapping before your script
closes
> > if you don't want to leave the mapping active.
>
> Thanks for your kind reply. My problem is that some people map to the
> drive and some don't. I get an error if I attempt to map to the drive
> when they have it done already. :-(

Does everyone have permissions to read from the directory with the log
files? If so, we could just use the UNC path, no need to map a drive or
check to see if a drive is mapped.



Re: FTP script to download, then delete a file who's name changes based on time. by gmedia

gmedia
Tue Dec 06 08:54:31 CST 2005

I have been using a product called Automate 6. Now I am able to
autmomatically FTP into one server download files based on date using
the "Now-1". I even automated the load process so that the files are
gathered and loaded automatically. Seems like a pretty good tool. I
was able to create hotkeys to Automate some day to day tasks and querey
reports. My boss asked me for a printout on last user logins. I had
the whole process setup to a hotkey on my keyboard already. I had it
printing out on his printer before he even got back. Yeah you can even
set what printer you want reports to print to. If you haven't tried it
before look into Automate6. It's like $800 but try the eval and you
will quickly see how much money can be saved automating.

Thanks for the help everyone.


Re: FTP script to download, then delete a file who's name changes based on time. by Angelia

Angelia
Fri Dec 09 07:33:21 CST 2005


James Whitlow wrote:

> Does everyone have permissions to read from the directory with the log
> files? If so, we could just use the UNC path, no need to map a drive or
> check to see if a drive is mapped.

No. I would have to use a separate user and password. What would the
code be to see if that drive is mapped?


Re: FTP script to download, then delete a file who's name changes based on time. by James

James
Fri Dec 09 11:14:23 CST 2005

"Angelia" <athoward@gmail.com> wrote in message
news:1134135201.557997.163210@g47g2000cwa.googlegroups.com...
>
> James Whitlow wrote:
>
> > Does everyone have permissions to read from the directory with the log
> > files? If so, we could just use the UNC path, no need to map a drive or
> > check to see if a drive is mapped.
>
> No. I would have to use a separate user and password. What would the
> code be to see if that drive is mapped?

You could probably get away with something like this:

For Each sDrive in oFSO.Drives
If LCase(sDrive.ShareName) = "\\servername\sharename" Then Exit For
Next

Select Case Len(sDrive)
Case 0
MsgBox "Drive not mapped. Add code here to map drive..."
Case Else
MsgBox "Drive " & sDrive & " is mappped to: " & sDrive.ShareName
End Select