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?
I am tring to use the upload adn delete script however my filemanes that I want to delete have spaces in teh filname and it wont delete them. I'm assuming the $item dosent list files with spaces in teh name how do I fix this?
FTP Script
  1. OPENHOST("biokey","ftp","")
  2.  
  3. # Change Directory to FTP
  4. CHDIR("/FTP")
  5.  
  6. # Change working directory to C:\AdvPubSafety\FTP Queue\Citation\
  7. LOCALCHDIR("C:\AdvPubSafety\FTP Queue\Citation\")
  8.  
  9. # Retrieve the  file listing
  10. $result=GETLIST($list,LOCAL_FILES,"*.*")
  11.  
  12. # If GETLIST failed stop the script
  13. IF($result!="OK")
  14.        STOP
  15.  
  16. # For each file in $list...
  17. FOREACH $item IN $list
  18.        # Upload the file
  19.        $result=PUTFILE($item)
  20.        # If the file has been succesfully uploaded
  21.        # delete the local copy of the file
  22.        IF($result=="OK")
  23.                EXEC("del ".$item)
  24.        END IF
  25.  
  26.  
You have to enclose between double quotes the file name within the EXEC command. For example:
FTP Script
  1. EXEC('del "'.$item.'"')
Well, it is a bit tricky because you have to use two single quote (') to enclose a text string that has double quotes ("). You can find a detailed explanation of this in the EXEC help topic:

http://www.scriptftp.com/reference.php?go=topic260

(see the remarks section)