Put command, what am I missing

Advertisement

GoBlue2
Joined:
Posts:
2

Put command, what am I missing

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\FTPlog\WinSCP.log" /ini=nul ^
/command ^
"option confirm off" ^
"put C:\XXXX\XXX\filename.xlsx /xxx/xx/xxx/upload" ^
"exit" ^

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%

I've removed the connecting info, but if I dont have filename.xlsx in there it works without issues and uploads the files.
I want to upload the specific file with a timestamp then remove the file locally after i am done.
Something is missing, either """ or something not sure.

Please helppp

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Put command, what am I missing

You are probably missing a slash at the end of the remote path:

"put C:\XXXX\XXX\filename.xlsx /xxx/xx/xxx/upload/" ^

See https://winscp.net/eng/docs/scriptcommand_put#remarks

If that does not hep, we need a log file.

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

To delete the local file after upload, add the -delete switch:
https://winscp.net/eng/docs/scriptcommand_put#delete

Reply with quote

Guest

file is uploading but not adding the time stamp added to it when its uploaded

"put C:\xxxxResponsys\filname%TIMESTAMP#yyyymmdd%.txt /xxx/xxx/xxx/xxx/" ^

what am I missing now?

Thanks

Reply with quote

GoBlue2
Joined:
Posts:
2

Is there a way to add a date to a file that does not currently have a date appended to it?

I want to add todays date to the file before I upload it.

file is uploading but not adding the time stamp added to it when its uploaded

"put C:\xxxxResponsys\filname%TIMESTAMP#yyyymmdd%.txt /xxx/xxx/xxx/xxx/" ^

what am I missing now?

Reply with quote

martin
Site Admin
martin avatar

You have to add the timestamp to the target name, not the source name:

"put C:\xxxxResponsys\filename.txt /xxx/xxx/xxx/xxx/*%TIMESTAMP#yyyymmdd%.*" ^

Reply with quote

Advertisement

You can post new topics in this forum