In script it's possible to TESt if a Extention (*.rar)
if Condition TRUE or not do
...
else
...
endif
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:
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
liked Script FTP? Try our other product Email Parser
Do you mean if it is possible to test if a file is a .rar file?To explain in my way :
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
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:
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
liked Script FTP? Try our other product Email Parser
Hi Floffy,That Exactly what i want !
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
- All times are UTC -