A customer recently asked:
I have an issue with a batch script that works perfectly in the windows world but when applied to the CompleteFTP Trigger/Batch Script it seems to fail to compare the first 5 characters of the file name. Can you advise of a script that will work in the CompleteFTP shell, don't mind if its not a batch script that will allow me to check for file name starting with "KEEP-" and where value not true to delete the file?Batch script value that is failing is:SET checkname=%FileName:~0,5%IF /I NOT "%checkname%"=="KEEP-" DEL /F /Q "%WindowsPath%"
I have an issue with a batch script that works perfectly in the windows world but when applied to the CompleteFTP Trigger/Batch Script it seems to fail to compare the first 5 characters of the file name. Can you advise of a script that will work in the CompleteFTP shell, don't mind if its not a batch script that will allow me to check for file name starting with "KEEP-" and where value not true to delete the file?
Batch script value that is failing is:SET checkname=%FileName:~0,5%IF /I NOT "%checkname%"=="KEEP-" DEL /F /Q "%WindowsPath%"
The solution was to assign %FileName% to another variable first:
SET checkname=%FileName%SET checkname=%checkname:~0,5%IF /I NOT "%checkname%"=="KEEP-" DEL /F /Q "%WindowsPath%"