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 using the current script below that runs every 30 minutes. I am looking to find a way to modify the log file to only save if it actually downloads files. I want to be able to save only files that have relavant data and currently have to go through each file to see what ones to keep.. Any suggestions?
Code: Select all#FPMSI - Download POD Orders to Creo # Connect to ftp.myhost.com as myuser $result=OPENHOST("address","username","pw") # If OPENHOST failed stop the script IF($result!="OK") STOP END IF # Change the current local directory. The files # will be downloaded here. $result=LOCALCHDIR("C:\VirtusPod") # If LOCALCHDIR failed stop the script IF($result!="OK") STOP END IF # Change current remote directory to CHDIR("out") $date=GETDATE $logfile="C:\VirtusPod\POD_Download_log-".$date.".txt" #Log Downloads LOGTO($logfile,append) #("C:\VirtusPod\PODdownloadlog.log",append) # Get the remote file listing, store it in $list $result=GETLIST($list,REMOTE_FILES,"*.*") # If GETLIST failed stop the script IF($result!="OK") STOP END IF # For each file in $list... FOREACH $item IN $list # Download the file $result=GETFILE($item) # If the file has been succesfully downloaded     # delete the remote copy. If not stop the script. IF($result=="OK") DELETEFILE($item) ELSE STOP END IF END FOREACH STOPLOG() #EXEC("Copy C:\VirtusPod\*.pdf D:\HotFolders\HF_VirtusC2") EXEC("cmd.exe /c C:\VirtusPod\virtus.bat") # Close the connection CLOSEHOST  
****** Updated. This answer is not related to what Fpmsi means. See the next post from ScriptFTP support.

Have you tried to enable the SILENT mode? Put it this on the top of your script file:
Code: Select all#Show only transferred files, errors and PRINT command messages: SILENT(ON)
Further info here:
http://www.scriptftp.com/reference.php?go=topic200

But feel free to post again if you have any question.
Thanks but that didnt seem to do what I am looking for.

The script about is using the following code to create a log file.. I want to save this log file with the file names and etc that it downloaded durint the run.
Code: Select all$date=GETDATE $logfile="C:\VirtusPod\POD_Download_log-".$date.".txt" #Log Downloads LOGTO($logfile,append)  
But if the script does not download anything it just imputs
GETLIST(REMOTE_FILES,"*.*")
Getting file listing of current remote directory
Found 0 files.

STOPLOG()
Stoping output logging

in the text document and saves the file.. So i have to go through all txt files to see what files have logs of downloads. So basically if Found files is 0 I dont want it to create a log..

Any ideas or if this is possible..
Thanks for the help...
Ok, now I understand your case. I suggest you to check first if there are files at the server before calling LOGTO. For example:
Code: Select all# Get the remote file listing, store it in $list $result=GETLIST($list,REMOTE_FILES,"*.*") # If GETLIST failed stop the script IF($result!="OK") STOP END IF # Count the number of elements of the list # If it is 0 we disconnect from the server and stop the script, IF(COUNTELEMENTS($list))==0) CLOSEHOST STOP END IF # Start logging from now on LOGTO("mylog.txt") # Files found. Do the stuff here
Note that the command COUNTELEMENTS is not documented, my fault, sorry.