Or how can i better skip previous folders
The issue with this code is that I have numeric folder names then i have alpha folder names.
The code syncs the numeric folder names but not the alpha folder names.
Is there a way to do "<" or ">" operations on an alpha string vs numeric string.
The issue with this code is that I have numeric folder names then i have alpha folder names.
The code syncs the numeric folder names but not the alpha folder names.
Is there a way to do "<" or ">" operations on an alpha string vs numeric string.
Code: Select all
#########################
:syncsubfolders
#########################
PRINT("syncronizing societe sub folders")
GETLIST($list,REMOTE_DIRECTORIES)
FOREACH $item IN $list
  # skip previous folders
  [b]IF($CurrentFolder < $item)[/b]
    PRINT("Set CurrentFolder: ".$item)
    $CurrentFolder = $item
    PRINT("syncronizing "."/Societe/".$item)
    $result_sync=SYNC("D:\Aeropack Synchro From Prod\Societe\".$item,"/Societe/".$item, DOWNLOAD, SUBDIRS)
    IF($result_sync!="OK")
      $errorcount = $errorcount + 1
      GOTO :errorhandler
    END IF
    PRINT("Reseting Connection")
    CLOSEHOST
    GOTO :openconnection
  END IF
END FOREACH
PRINT("societe sub folders syncronized")
The code syncs the numeric folder names but not the alpha folder names.Very strange, could you post your script output?
Is there a way to do "<" or ">" operations on an alpha string vs numeric string.ScriptFTP does not care about data types, in fact the numbers are also strings. the < and > operators compare two strings if any of them is, for example, "myfolder" it is interpreted as a 0.
liked Script FTP? Try our other product Email Parser
I did catch this from the Script Guide but it was listed under the Arithmetical operators (+ - * /)
But not for these (== =!)
I don't know about these though (<= >=)
I added this print statement and commented out the actual sync command to get this output
Code: Select all
But i guess this also applies to some of the Comparasion operators (< >)# If you try to use a text value in an arithmethical
# expression it's interpreted as a zero:
$thisiszero= 5*"abcdef"
But not for these (== =!)
I don't know about these though (<= >=)
I added this print statement and commented out the actual sync command to get this output
Code: Select all
Here is the output i get right when it switches to alpha foldernames$isnotdone = $CurrentFolder < $item
PRINT($CurrentFolder."<".$item."=".$isnotdone)
GETLIST(REMOTE_DIRECTORIES)
Getting directory listing of current remote directory
Found 183 directories.
167<_vti_pvt=FALSE (I just noticed these are skipped too)
167<_Wondair=FALSE (I just noticed these are skipped too)
167<132=FALSE
167<137=FALSE
...
167<164=FALSE
167<167=FALSE
167<175=TRUE (GOOD)
Set CurrentFolder: 175
syncronizing /Societe/175
Reseting Connection
CLOSEHOST
Disconnected.
opening connection
OPENHOST("1.2.3.4","FTPSynchro",)
Connecting to 1.2.3.4
Connected.
connection open
Changing remote directory to /Societe
CHDIR("/Societe")
Changing current remote directory to /Societe
syncronizing societe sub folders
GETLIST(REMOTE_DIRECTORIES)
Getting directory listing of current remote directory
Found 183 directories.
175<_vti_pvt=FALSE
175<_Wondair=FALSE
175<132=FALSE
175<137=FALSE
...
175<164=FALSE
175<167=FALSE
175<175=FALSE
175<aerien=FALSE (???)
175<aeroportugal=FALSE (???)
175<AeroNorte=FALSE (???)
...