Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in CompleteFTP by (158k points)
closed by

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%"

closed with the note: admin answered

1 Answer

0 votes
by (158k points)
Best answer

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%"