In WS_FTP (using ftpscrpt), how can I rename files on the remote FTP site after the file has been successfully transferred?

I have to transfer large zip files using ftpscrpt. Since there are processes on the remote ftp site that are looking for files and are triggered immediately after the file is detected, I cannot transferred them as *.zip files. So, I am renaming them as *.tmp before the ftpscrpt command, then transferring them and then after the transfer would like to rename them the *.tmp to *.zip on the remote FTP site. I am using windows batch and ws_ftp (ftscrpt) commands to transfer the file and am running these scripts using a job scheduler. The rename command I have at the end (in bold) doesn't work and any assistance provided is greatly appreciated. I am looping through files using a do loop in my windows batch file so that I transfer one file at a time.

 

 

Windows batch script:

 

for %%f in (*.zip) do (

echo Starting to process file..... %%f

echo Renaming file... %%f to have a *.tmp extension

rename *.zip *.tmp

echo FTPing file... %%f

"ftpscrpt" -f ftp_script.scp

@if %errorlevel% NEQ 0 (exit -4)

)

 

FTP script (ftp_script.scp):

 

TRACE SCREEN

LOG SCREEN

ONERROR EXIT

USER xxxxxx

PASS yyyyyy

CONNECT zzzzzzzzz

CD /incoming

ONERROR CONTINUE

DIR *.tmp

postxfer pxdelete

MPUT *.tmp

postxfer pxoff

DIR *.tmp

DIR  *.zip

RENAME *.tmp *.zip

DIR  *.zip

CLOSE

 


Patricia Adams likes this.
  • Girish Mulubagal (Customer)

    I tried it and that will not work. POSTXFER PXRENAME will only rename the file on the local folder/ftp site after successful transfer. I need to rename the file on the remote folder/ftp site after the file has been successfully transferred.

  • Samik Chakraborty (Progress Software Development)

    This would require some investigation.

     

    However, if you use MGET to download the file from remote SFTP to local drive then Pxrename should be renaming the file.

     

    You can raise a case with Technical support and we shall try to assist you further.

     

    Please select the answer as best if you find this suitable. It would help/guide others who might come up with a similar query.