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
Wildcards in FTPPut
Moderators: Dorian (MJT support), JRL
More Clarification
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.
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:
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
In the original script you posted, you had a line that said:
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.If>IfFileExists>*.txt,Start
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