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?
Im running the following script to rename several files but is there a way to stop after a certain amount of renames. Like stop after you rename 150 files.
FTP Script
  1. GETLIST($List, REMOTE_FILES)
  2. $Count=100
  3.  
  4. FOREACH $Item IN $List
  5.   RENAMEFILE($Item, "wxcam".$Count.".jpg")
  6.   $Count=$Count+1
Something like this:
FTP Script
  1. GETLIST($List, REMOTE_FILES)
  2.  
  3. #The number of files to rename
  4. $RenCount = 150
  5. #The initial number
  6. $Count = 100
  7.  
  8. $RenCount = $RenCount+$Count
  9. $List = TEXTCUT($List, 2, -1)."|"
  10.  
  11. :Start
  12. $i=2
  13.  
  14. WHILE(($i < TEXTLENGTH($List)) AND ($Count <= $RenCount))
  15.   IF(TEXTCUT($List, $i, 1) == "|")
  16.     RENAMEFILE(TEXTCUT($List, 1, $i-1), "wxcam".$Count.".jpg")
  17.     $List = TEXTCUT($List, $i+1, -1)
  18.     $Count = $Count+1
  19.     GOTO :Start
  20.   END IF
  21.   $i = $i+1
ScriptFTP support, documentation GETLIST

http://scriptftp.com/reference.php?go=topic180

inaccuracy need to fix, I have written before, but somehow not corrected until now:
Every ScriptFTP variable contains a text string and the list that this command creates is not an exception. The character "|" is used to separate the items of the list. Therefore, you can also build file lists without GETLIST. For example: $mylist="|a.txt|b.txt|c.txt".