Jump to content

Need Help with FPTex to do an mget like command


Recommended Posts

I have scoured both this site and the internet for 2 days looking for a decent way to use the ftp 'mget' command.

Most of the sources here say to use _FTPFileFindFirst() and _FTPFileFindNext() but there is no real code on what to do once you use it nor is there any meat to those conversations.

My situation is that I have been asked to be able to log onto a specific server once a week and download all log files for that week.

The problem is that each day is kept in it's own folder.

Something like WA0, WA1, etc, etc.

What I do not know is how many and what the names of the log files under each directory there are.

So what I need to do is to be able to go into the general folder - where the log folders are, and mget * to someplace like C:\Logs\.

I have looked at the _FTP_Command but there are no examples for that in the help - just a "Search FtpCommand in MSDN Library" - they don't have examples either.

I've looked at FTPGetFile - but that also doesn't help.

Most of the forum help seems to be leaning towards PUTting a file onto a server, not GETting one or more.

Oh - and the _FTPFileFindFirst() and _FTPFileFindNext() doesn't seem to handle the Unknown Quantity, so how would I loop until I've got no more? And then once I get the file name, how do I copy that folder - and all of it's contents - in the local folder?

Any help on this would be appreciated.

Edited by ChrisA
Link to comment
Share on other sites

Hi.

ftp.exe is capable to be "controlled" by a text file, that's simply a clear text batch holding all the commands you would normally type directly in the CLI of FTP.EXE. See output of "ftp.exe --help".

That control file can be created through autoit easyly.

Or use wget.exe instead, wrap it into an autoit script to meet special needs.

regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Oh - and the _FTPFileFindFirst() and _FTPFileFindNext() doesn't seem to handle the Unknown Quantity, so how would I loop until I've got no more? And then once I get the file name, how do I copy that folder - and all of it's contents - in the local folder?

I would use _FTP_ListToArray(2D/Ex) instead, and loop through the results.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Rudi - Yes, I am very well aware of how to use FTP via command line. If that's what I needed to use I would simply write a batch file and copy it to every machine I needed to pull it from.

Due to security I cannot have a plain text file with the directory structure, usernames, or passwords visible to any casual user who may happen to find it - thus I am looking at a compiled applet to contain all the information I need.

No - writing it out to a text file, running the command and then deleting the text file is not an option as the text file would be there for how ever long.

Skruge - I will look into those - but the _FTPFileGet still has issues trying to get a directory - I've tried.

I was hoping NOT to do:

Loop through Directories

MkDir of found Directory

Get List of File in Directory

CD to found directory

_FileGetFile Each File indiviudally in this directory

CD ..

EndLoop

I was hoping to just do a simple MGet - which can pull files/directories with no issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...