Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VIEWING FILE FILAGS IN FTP

Status
Not open for further replies.

Volkmaniac

Technical User
Mar 19, 2003
104
US
I've come across a problem using ProComm's ftp.

I have to grab a file every morning and they have a flag instituted to tell me which file to grab. The flag precedes the file name. I can see the flag when I open Wintelnet but I can only see the filename when I use ProComm.

Wintelnet:

-AR------TCP B mailbox 4095 112905 Sep 11 21:24 RFIIAR2I.ZIP

ProComm

RFIIAR2I.ZIP

I realized I couldn't use "-AR-" as the remote file filter so I tried using the following code to try and grab the latest file. That didn't work either. It kept coming up with NO BATCHES TO SEND. Has anyone ever encountered this before?

#define SearchString "*.ZIP" ;Path to file spec


proc GetNewest

long Newest ;Maintain date/time for newest file found
fname = "[ None ]" ;Default to [ None ] for name
if findfirst SearchString ;Find the first file
Newest = $FLTIME ;Get the first file's date/time info
fname = $FILENAME ;Get the first file's name
while findnext ;Find the next file
if $FLTIME >= Newest ;Is this ones date/time newer?
Newest = $FLTIME ;Get the new file's date/time info
fname = $FILENAME ;Get the new file's file name
endif
endwhile
endif

endproc








 
Actually, when I hit Expand Remote Folder it does give me the full filename:

-AR-------TCP B mailbox 4094 112905 Sep 11 21:24 RFIIAR2I.ZIP

How can I grab this file?
 
The code you posted will only work on the local files and not the files on the FTP server. I think the only way to get this information programmatically is to have your script access the FTP | Expand Remote Folder menu item (which will cause the data to load in an editor), pause a couple seconds, save the file to a known location, close the editor, then open that file and parse for the filter string you are looking for. sendkey ALT 'P' follow by sendkey 'E' will bring up the file listing.


aspect@aspectscripting.com
 
I may try something different. I'm already transferring files from our Unix remote to my local but that grabs every file in the directory. I'm not sure if I can grab a specific file.

I think there might be another reason it's not working. The guy who used to do this said that he was only able to transfer the file through DOS because it's a secure FTP site.

ftp ftp.firstdatasolutions.com

connected to fdsftsux1.firstdatasolutions.com

Enterprise for Unix 1.3.01 Secure FTP

I'll give your suggestion a try and get back to you.

Thanks again,

Volkmaniac
 
I forgot to mention, I had to type DIR in DOS to get the file listing, then BIN to switch transfer mode to binary. I included set ftp xfermode BINARY in my script. I might try this:

ftp remote filelist "S:\Client Services\LETTERS\fastdata.txt" ;create directory file listing
pause 3
fopen 0 "S:\Client Services\LETTERS\fastdata.txt" read tex

I'll probably have to delimit the file listing after I grab it but it just might work.
 
I don't think ftp remote filelist will work for you since I think it only contains the filenames and not all of the information displayed about the file. But I'm about to leave work so I can't test that just now.


aspect@aspectscripting.com
 
I was able to pull up the directory listing with the sendkeys but I'm not sure what to do from there. The problem is that it's never the same file name. It could either be [FTP.0001.DIR], [FTP.0002.DIR] and so on. I was thinking about creating a text file, copying the FTP file listing using filetoclip, pasting it in the new text file, and then reading it for file fname.
 
What I would do is pause a few seconds for the directory listing to come up in whatever application it is associated with on your machine (ASPECT Editor, most likely). Then, use sendkey to save that file to a known path and filename. You may want to perform an isfile on that file before doing so so you can delete the temp. file from any previous runs of your script and have one less problem to deal with.


aspect@aspectscripting.com
 
It ended up working. The file flag ended up being a blessing because it only allows me to copy the file with the flag over. It will still try to copy every file in the directory over but it only ends up moving the one with the flag.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top