Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Command to rename sFTP file with date/time stamp

I know it not exactly, what you need. But it shows how to do this kind of task.
Guest

Re: Command to rename sFTP file with date/time stamp

martin wrote:

ak wrote:

Can above command be used on sFTP server?

No.
This example may help you:
https://winscp.net/eng/docs/script_download_timestamped_filename


Thanks for reply. Not quite what I need. Would like to know best way/how to rename an sFTP file with a date/time stamp on the sFTP server using WinSCP to automatically do this.

Example:
File on sFTP server is 'ABC.dat'
I want to rename file on the server to be 'ABC_YYYY_MM_DD.dat'.

Can you advise?

Thank you.
ak

Command to rename sFTP file with date/time stamp

Tried Command: mv ! $(echo "!" | sed "s/\..*$//").$(date '+%Y-%m-%d_%H-%M').$(echo ! | awk -F"." '{ print $NF }')

Get error:
Error listing directory 's/\..*$//' .
No such file or directory.
Error code: 2
Error message from server (en): invalid path
Request code: 11

Please advise what 's/\..*$//' should be? Can above command be used on sFTP server?