ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
In script it's possible to TESt if a Extention (*.rar)
if Condition TRUE or not do
...
else
...
endif
Do you mean if it is possible to test if a file is a .rar file?

In that case, it is done this way:
Code: Select all$filename="myarchive.rar" # Get the number of characters of the file name $num_of_characters=TEXTLENGTH($filename) # Get the three last characters $file_extension=TEXTCUT($filename,$num_of_characters-2,3) IF($file_extension=="rar")  PRINT("It is a rar file") ELSE  PRINT("It is NOT a rar file") END IF
Do you mean if it is possible to test if a file is a .rar file?

In that case, it is done this way:
Code: Select all$filename="myarchive.rar" # Get the number of characters of the file name $num_of_characters=TEXTLENGTH($filename) # Get the three last characters $file_extension=TEXTCUT($filename,$num_of_characters-2,3) IF($file_extension=="rar")  PRINT("It is a rar file") ELSE  PRINT("It is NOT a rar file") END IF
To explain in my way :
What i want to do is

If exist d:\upl\*.rar then
SETMODEZ(OFF)
else
SETMODEZ(ON)
endif
I want to test each files !
Hi Floffy,

Ahh ok, so you want to test if a directory contains one or more rar files. In the case there are deactivate MODE Z, in the other case activate it.

Well, it is done this way. I hope this example helps:
Code: Select all# Change current directory to D:\UPL LOCALCHDIR("d:\upl") # Get file listing of D:\upl GETLIST($file_list,LOCAL_FILES,"*.rar") # Check if one or more rar files were found IF(COUNTELEMENTS($file_list)>0)  SETMODEZ(OFF) ELSE  SETMODEZ(ON) END IF
Hi Floffy,

Ahh ok, so you want to test if a directory contains one or more rar files. In the case there are deactivate MODE Z, in the other case activate it.

Well, it is done this way. I hope this example helps:
Code: Select all# Change current directory to D:\UPL LOCALCHDIR("d:\upl") # Get file listing of D:\upl GETLIST($file_list,LOCAL_FILES,"*.rar") # Check if one or more rar files were found IF(COUNTELEMENTS($file_list)>0)  SETMODEZ(OFF) ELSE  SETMODEZ(ON) END IF
That Exactly what i want !