08-30-2012 04:37 AM
Hi All,
Do you have any idea how to upload a file to FTP that is created using write file activity in CPO.We are able to save the file in the local path of the server.
Thanks,
Ram
08-30-2012 06:06 AM
I would suggest you use command line FTP. I know some of done it like that. You could use the PUT file activity if using SFTP on a unix box, but for windows box, I would say command line FTP is your best bet.
-shaun
08-30-2012 06:12 AM
Hi Shaun,
I tried the same thing as you said. We have created a batch file with the FTP commands and tried to execute the batch file using the Execute Windows Command activity. But the the windows command state says running for so much time but not getting to succees state.
Is the approach correct or there is any other activity to run the batch file?
Thanks & Regards,
Atchut.
08-30-2012 06:57 AM
Hi,
Works fine for me. Here is the batch script I wrote up...
@ECHO OFF
:: Check if the password was given
IF "%2"=="" GOTO Syntax
:: Create the temporary script file
> script.ftp ECHO %1
>>script.ftp ECHO %2
>>script.ftp ECHO cd %3
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put %4
>>script.ftp ECHO quit
:: Use the temporary script for unattended FTP
:: Note: depending on your OS version you may have to add a '-n' switch
FTP -s:script.ftp %5
:: For the paranoid: overwrite the temporary file before deleting it
TYPE NUL >script.ftp
DEL script.ftp
GOTO End
:Syntax
ECHO Usage: %0 username password folder file server
:End
Then call it like
ftpBatch.bat
This is of course to move a file from your server to an FTP. I wrote the script and the process and got it working in like 15 minutes, so should not be too bad. The script is very basic though and for production level you'd probably want something more robust.
If you need help and have a services contract, you can open a TAC case if you are seeing a specific issue.
If this script does not work for you, there are plenty of batch based FTP file scripts out there to build on.
-shaun
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide