Hello.
I have a directory that contains 2 different type of files.
fe. 12345.txt & 12345.ok
In principle there is no problem but...
I want the txt file to be moved to a seperate folder after successfull transfer, and the OK file to be deleted.
Currently i have 2 seperate batches but that takes to long if you have hundred's of files to be uploaded
My currentscript is:
If possible i could then upload the the same files in 1 process.
thanks
I have a directory that contains 2 different type of files.
fe. 12345.txt & 12345.ok
In principle there is no problem but...
I want the txt file to be moved to a seperate folder after successfull transfer, and the OK file to be deleted.
Currently i have 2 seperate batches but that takes to long if you have hundred's of files to be uploaded
My currentscript is:
Code: Select all
Would it be possible to do 1 getlist for all the files and the create a parameter/item for the txt file and a seperate for the OK file?# --------------------
# Slighly modified by ScriptFTP support to fit the description given by the user
# --------------------
:batch2
LOCALCHDIR($local_dir_temp)
GETLIST($mytxtlist,LOCAL_FILES,"*.txt")
FOREACH $txtfile IN $mytxtlist
$result=PUTFILE($txtfile)
IF($result=="OK")
EXEC("move ".$txtfile." D:\abg\files\ZPL\".$txtfile)
PRINT("Move...... ".$txtfile." to the ZPL folder")
ELSE
EXEC($blat_cmd_line_2)
EXEC("move ".$txtfile." D:\abg\errorfiles\".$txtfile)
PRINT("Moved ".$txtfile." to the error folder")
END IF
END FOREACH
########################################################################################
# Uploading the trigger files that are in the TEMP folder
# after successfull upload, delete all the trg files in 1 batch sequence
########################################################################################
:batch3
GETLIST($mytrglist,LOCAL_FILES,"*.end")
FOREACH $trgfile IN $mytrglist
$result2=PUTFILE($trgfile)
END FOREACH
EXEC("del /F /Q *.end")
If possible i could then upload the the same files in 1 process.
thanks
Hello Marty,
Currently i have 2 seperate batches but that takes to long if you have hundred's of files to be uploadedYes, that is normal. For every file ScriptFTP have to call some external commands. Don' t expect a great performance.
Would it be possible to do 1 getlist for all the files and the create a parameter/item for the txt file and a seperate for the OK file?You can do a GETLIST($allfiles,LOCAL_FILES,"*.*") to retrieve all the file listing and then for every file name of the list extract the last 3 characters:
Code: Select all
May be this answers your question. Could you explain the last chunk of the script where you upload trigger files? You didn't explain that step in your message.GETLIST($allfiles,LOCAL_FILES,"*.*")
FOREACH $file IN $allfiles
$number_of_characters=TEXTLENGTH($filename)
$file_extension=TEXTCUT($file,$number_of_characters-3,-1)
PRINT("File extension is ". $file_extension)
IF($file_extension=="txt")
# Upload the .txt file
# move the local copy of the .txt file
# remove .ok file
END IF
END FOREACH
liked Script FTP? Try our other product Email Parser