Wildcards in FTPPut

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
MMurch
Newbie
Posts: 3
Joined: Mon Mar 31, 2003 8:48 pm

Wildcards in FTPPut

Post by MMurch » Mon Mar 31, 2003 8:54 pm

This is a script that I've written to look for a file and send it to an FTP server. Unfortunatly the wildcards are not working. Can anyone point me in the right direction. If I use a file name such as file.txt it transfers fine!!!! Please advise on a better way... Thanks :?

Label>Start
Change Directory>e:\test_out
IfFileExists>*.txt,Process
If>IfFileExists>*.txt,Start
Label>Process
Gettime>time
ftpputfile>192.000.000.000,root,tincan,21,e:\test_out\*.txt,/u/work/pitbowes/*.txt,A
MOV>e:\test_out\*.txt,e:\Archive\
Deletefile>e:\test_out\*.txt
Goto>Start

MMurch
Newbie
Posts: 3
Joined: Mon Mar 31, 2003 8:48 pm

More Clarification

Post by MMurch » Tue Apr 01, 2003 3:34 am

In reading my post I realized that more information was probably needed. the script that I have written is looking for a file that is generated in an external program, when it finds that a file is present it starts an FTPPut command. The file name is constantly changing and I would like to transfer that file to the FTP server. The problem that I am having is that it is not excepting the *.txt wildcard for FTP transfer. Is there someway that I can do this? Thanks in advance for any help.

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Tue Apr 01, 2003 7:48 am

The FTPPutFile command does not accept wildcards. You can create your own method using the "GetFileList" and "Position" commands to see if files contain specific characters, and then make a loop that uploads just those files.

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Tue Apr 01, 2003 9:31 pm

Here's the type of method I was talking about. It can be improved upon, checking the FTP_RESULT variable for example, to see if the upload was ok or not.

In the original script you posted, you had a line that said:
If>IfFileExists>*.txt,Start
Whatever you were trying to do here, it's not going to work like this. The expressions in the "If" command can't contain other commands... but you could set a value from a previous operation, and check it that way.

Let>sFolder=E:\test_out\
Let>sMask=*.txt

IfDirExists>%sFolder%,DirectoryOK
MessageModal>The path "%sFolder%% is not valid.%CRLF%Script terminated.
Goto>TheEnd

Label>DirectoryOK
IfFileExists>%sFolder%%sMask%,FilesExist
MessageModal>Pattern not found: %sFolder%%sMask%
Goto>TheEnd

Label>FilesExist
GetFileList>%sFolder%%sMask%,sFiles
Separate>%sFiles%,;,file_names
MessageModal>Matching file count: %file_names_count%

Let>k=0
Repeat>k
Let>k=k+1
Let>sFileName=file_names_%k%
FTPPutFile>192.000.000.000,root,tincan,21,%sFolder%%sFileName%,/u/work/pitbowes/%sFileName%,A
Until>k,%file_names_count%

Label>TheEnd

MMurch
Newbie
Posts: 3
Joined: Mon Mar 31, 2003 8:48 pm

Post by MMurch » Wed Apr 02, 2003 2:50 am

Captive,

Thanks for the help I actually figured it out!

The following line of code actually does work, it looks for a file if it doesn't find it it loops back to start. I don't know if it shouldn't work, but it does.


If>IfFileExists>*.txt,Start




Thanks again for the help.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts