Preserve Remote Timestamp - Command Line?

Advertisement

Myriad_Rocker
Guest

Preserve Remote Timestamp - Command Line?

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.

Reply with quote

Advertisement

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.

Reply with quote

Guest

Re: Preserve Remote Timestamp - Command Line?

martin 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.

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?

Reply with quote

Guest

Re: Preserve Remote Timestamp - Command Line?

martin 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.

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?

Reply with quote

Myriad_Rocker
Joined:
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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
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

Reply with quote

Myriad_Rocker
Joined:
Posts:
5
Location:
U.S.

martin 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?

Reply with quote

Myriad_Rocker
Joined:
Posts:
5
Location:
U.S.

Myriad_Rocker wrote:

martin 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?

Reply with quote

Myriad_Rocker
Joined:
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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
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).
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

Reply with quote

Advertisement

You can post new topics in this forum