Topic "Put command, what am I missing"

Author Message
GoBlue2
[View user's profile]

Joined: 2017-02-12
Posts: 2
@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
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
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
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
GoBlue2
[View user's profile]

Joined: 2017-02-12
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?
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
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%.*" ^
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License