Topic "Preserve Remote Timestamp - Command Line?"

Author Message
Myriad_Rocker

Guest


I know you can set 'Preserve Remote Timestamp' in the GUI. But can you do it on the command line? I'm not using the GUI to transfer...I'm using command via a perl script.
Advertisements
Myriad_Rocker

Guest


Really? No one?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
It should be enabled by default, but anyway, try to use -preservetime switch:
https://winscp.net/eng/docs/scriptcommand_put
https://winscp.net/eng/docs/scriptcommand_get
_________________
Martin Prikryl
Myriad_Rocker

Guest


Yeah, it's definitely changing the time stamp. By one hour exactly. I combed the site and did not find the stuff you linked to. I appreciate it. I will try this out.
Guest




prikryl wrote:
It should be enabled by default, but anyway, try to use -preservetime switch:
https://winscp.net/eng/docs/scriptcommand_put
https://winscp.net/eng/docs/scriptcommand_get


Ok, I tried this. It didn't work but maybe I am doing it incorrectly. Here is the command in my perl script.

Code:
my $command = "winscp.com /command \"option batch abort\" \"option confirm off\" \"open -hostkey\=\"\"ssh-rsa 1024 6a:b7:2a:ad:31:05:f6:e0:74:78:59:d8:64:e8:17:fd\"\" <removed by admin>\" \"put -preservetime \"\"$search_path\\$x\"\" $target\" \"exit\"";


Notice that I put the -preservetime switch right after the put. Is that where it is supposed to go? When I used this, the file transferred successfully, but the timestamp was back one hour. Original Stamp: 3:05AM After transfer: 2:05AM

Thoughts?
Myriad_Rocker

Guest


Oh crap...would a forum mod mind deleting the IP and user creds from that bit of code above?
Guest




prikryl wrote:
It should be enabled by default, but anyway, try to use -preservetime switch:
https://winscp.net/eng/docs/scriptcommand_put
https://winscp.net/eng/docs/scriptcommand_get


Ok, I tried this. It didn't work but maybe I am doing it incorrectly. Here is the command in my perl script.

Code:
my $command = "winscp.com /command \"option batch abort\" \"option confirm off\" \"open -hostkey\=\"\"ssh-rsa 1024 6a:b7:2a:ad:31:05:f6:e0:74:78:59:d8:64:e8:17:fd\"\" user1:password\@11.111.111.111\" \"put -preservetime \"\"$search_path\\$x\"\" $target\" \"exit\"";


Notice that I put the -preservetime switch right after the put. Is that where it is supposed to go? When I used this, the file transferred successfully, but the timestamp was back one hour. Original Stamp: 3:05AM After transfer: 2:05AM

Thoughts?
Myriad_Rocker
[View user's profile]

Joined: 2012-03-20
Posts: 5
Location: U.S.
Thanks to the mod who deleted the user info. I appreciate it.

On another note, does anyone know if I'm using the -preservetime switch correctly? It is not working where I have it after the put keyword. The time is still moving back one hour after the transfer. This only occurs during DST, I believe.
Myriad_Rocker
[View user's profile]

Joined: 2012-03-20
Posts: 5
Location: U.S.
Okay, so I changed it up and put it as an option, but the command window is saying "Unknown switch 'preservetime'"
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Myriad_Rocker wrote:
On another note, does anyone know if I'm using the -preservetime switch correctly? It is not working where I have it after the put keyword. The time is still moving back one hour after the transfer. This only occurs during DST, I believe.

Ok, so it is preserving the time actually, isn't it? Just incorrectly. So the problem is elsewhere.
Please read:
https://winscp.net/eng/docs/timestamp
_________________
Martin Prikryl
Myriad_Rocker
[View user's profile]

Joined: 2012-03-20
Posts: 5
Location: U.S.
prikryl wrote:
Myriad_Rocker wrote:
On another note, does anyone know if I'm using the -preservetime switch correctly? It is not working where I have it after the put keyword. The time is still moving back one hour after the transfer. This only occurs during DST, I believe.

Ok, so it is preserving the time actually, isn't it? Just incorrectly. So the problem is elsewhere.
Please read:
https://winscp.net/eng/docs/timestamp

I had this issue when using the Saved Sessions to access instead of embedding the host key directly as I am above. I fixed it by adjusting something, I know that. Is there a switch for the Adjust Remote Timestamp with DST setting?

Myriad_Rocker
[View user's profile]

Joined: 2012-03-20
Posts: 5
Location: U.S.
Myriad_Rocker wrote:
prikryl wrote:
Myriad_Rocker wrote:
On another note, does anyone know if I'm using the -preservetime switch correctly? It is not working where I have it after the put keyword. The time is still moving back one hour after the transfer. This only occurs during DST, I believe.

Ok, so it is preserving the time actually, isn't it? Just incorrectly. So the problem is elsewhere.
Please read:
https://winscp.net/eng/docs/timestamp

I had this issue when using the Saved Sessions to access instead of embedding the host key directly as I am above. I fixed it by adjusting something, I know that. Is there a switch for the Adjust Remote Timestamp with DST setting?



I can confirm that, when I create a session and use that session at command with the "Adjust remote timestamp with DST" option selection, it works perfectly. I'd like to NOT use a saved session, though. I'd like to connect with a connection string in my command.

So...what is the switch to set "Adjust remote timestamp with DST"? And where do I place it? On the put level or on the option level?
Myriad_Rocker
[View user's profile]

Joined: 2012-03-20
Posts: 5
Location: U.S.
Alright, I fixed this by inserting a new DWORD into the Default Settings of WinSCP in the registry. I looked at a saved session to get the key word, which is ConsiderDST. Value should be 0.

I also saw a rawsettings function but the page said it only worked with the beta. But it didn't say which version. I'd like to set this ConsiderDST setting on command line, so how would I do that? I don't want to have to alter the registry for this kind of thing.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Myriad_Rocker wrote:
I also saw a rawsettings function but the page said it only worked with the beta. But it didn't say which version.

Always use the latest version (5.0.6 beta currently).
Quote:
I'd like to set this ConsiderDST setting on command line, so how would I do that? I don't want to have to alter the registry for this kind of thing.

/rawsettings ConsiderDST=0

https://winscp.net/eng/docs/faq_script_ini
https://winscp.net/eng/docs/commandline
Advertisements

You can post new topics in this forum






Search Site

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