Topic "Is there any option in get command to preserve the time"

Author Message
guest

Guest


Please forgive my ignorance.

I have this requirement where I need to preserve the timestamp in certain cases and in some other cases I want to get the files with the current timestamp. Is there any option with winscp which I can use to change the setting for the session?

I am using WINSCP 3.7.4.

Please help.

Thanks
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
There's preserve timstamp option.
_________________
Martin Prikryl
guest

Guest


prikryl wrote:
There's preserve timstamp option.


Thanks for the quick response.
How can i use preserve timestamp in batch? I am doing the upload from a unix server to Windows 2003 server in batch mode using DTS.

Please help.

Thanks.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
guest wrote:
Thanks for the quick response.
How can i use preserve timestamp in batch? I am doing the upload from a unix server to Windows 2003 server in batch mode using DTS.

If you mean scripting, there's no command for that. You may find this FAQ helpful.
_________________
Martin Prikryl
guest

Guest


prikryl wrote:
guest wrote:
Thanks for the quick response.
How can i use preserve timestamp in batch? I am doing the upload from a unix server to Windows 2003 server in batch mode using DTS.

If you mean scripting, there's no command for that. You may find this FAQ helpful.


Thanks once again.

Actually I am facing a new problem now. I created an ini file and using the following command to run winscp
winscp3.com /console /script=c:\temp\abc.txt /ini="c:\program files\winscp3\winscp3.ini". In this ini file I am using PreserveTime=1.

When I run the script on my desktop, this runs fine and preserve the timestamp for the unix file. If the same ini file I copy to my windows 2003 server and run the process, the timestamp is lost. What could be the reason?

Thanks.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
guest wrote:
Actually I am facing a new problem now. I created an ini file and using the following command to run winscp
winscp3.com /console /script=c:\temp\abc.txt /ini="c:\program files\winscp3\winscp3.ini". In this ini file I am using PreserveTime=1.

When I run the script on my desktop, this runs fine and preserve the timestamp for the unix file. If the same ini file I copy to my windows 2003 server and run the process, the timestamp is lost. What could be the reason?

Are you sure that the /ini settings takes effect? You may have simply different defaults on the machines.
_________________
Martin Prikryl
Guest




prikryl wrote:
guest wrote:
Actually I am facing a new problem now. I created an ini file and using the following command to run winscp
winscp3.com /console /script=c:\temp\abc.txt /ini="c:\program files\winscp3\winscp3.ini". In this ini file I am using PreserveTime=1.

When I run the script on my desktop, this runs fine and preserve the timestamp for the unix file. If the same ini file I copy to my windows 2003 server and run the process, the timestamp is lost. What could be the reason?

Are you sure that the /ini settings takes effect? You may have simply different defaults on the machines.


Yes, it does use the ini file because the location of the key file is getting picked from there. One strange thing happened today in the script if I give the Server address the timestamp is not maintained. However if I give the actual drive letter let say C:\ then it is maintaining the timestamp. Now I am more confused, we don't want to take the hard coding approach because the drive letter might change for server migration. I use the same ini file.

get /home/kapoor/output/abc.txt \\sjcabc\reports\inbound ---- does not work
get /home/kapoor/output/abc.txt c:\reports\inbound --- It works perfect.

Please help
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
Quote:
Yes, it does use the ini file because the location of the key file is getting picked from there. One strange thing happened today in the script if I give the Server address the timestamp is not maintained. However if I give the actual drive letter let say C:\ then it is maintaining the timestamp. Now I am more confused, we don't want to take the hard coding approach because the drive letter might change for server migration. I use the same ini file.

get /home/kapoor/output/abc.txt \\sjcabc\reports\inbound ---- does not work
get /home/kapoor/output/abc.txt c:\reports\inbound --- It works perfect.

I'm not aware of such problem. I'll check that.
Guest




prikryl wrote:
Quote:
Yes, it does use the ini file because the location of the key file is getting picked from there. One strange thing happened today in the script if I give the Server address the timestamp is not maintained. However if I give the actual drive letter let say C:\ then it is maintaining the timestamp. Now I am more confused, we don't want to take the hard coding approach because the drive letter might change for server migration. I use the same ini file.

get /home/kapoor/output/abc.txt \\sjcabc\reports\inbound ---- does not work
get /home/kapoor/output/abc.txt c:\reports\inbound --- It works perfect.

I'm not aware of such problem. I'll check that.


Thanks a lot for all your help.

Can you please let me know once you have some information.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
I wan't able to reproduce the problem. Do you use SFTP or SCP protocol? Does the problem happen in GUI also? I.e. if you use the /ini parameter to change defaults does the timestamp gets updated on download?
_________________
Martin Prikryl
anurag_kapoor
[View user's profile]

Joined: 2006-09-22
Posts: 2
Location: San Jose
prikryl wrote:
I wan't able to reproduce the problem. Do you use SFTP or SCP protocol? Does the problem happen in GUI also? I.e. if you use the /ini parameter to change defaults does the timestamp gets updated on download?


We are using SFTP with SCP fallback. The problem does not happen in GUI (I think this is because I go by the mapped drive and not with the server name). The timestamp is reflected correctly.

This problem only happens if I use batch option (script) and that too when I specify the whole server address and not the Drive letter.

Thanks
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
anurag_kapoor wrote:
We are using SFTP with SCP fallback. The problem does not happen in GUI (I think this is because I go by the mapped drive and not with the server name). The timestamp is reflected correctly.

What if you type in UNC path manually to "destination" box?
_________________
Martin Prikryl
anurag_kapoor
[View user's profile]

Joined: 2006-09-22
Posts: 2
Location: San Jose
prikryl wrote:
wrote:
We are using SFTP with SCP fallback. The problem does not happen in GUI (I think this is because I go by the mapped drive and not with the server name). The timestamp is reflected correctly.

What if you type in UNC path manually to "destination" box?


I face the same problem if I specify UNC path in the destination box. It changes the timestamp to the current timestamp.

Please help
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
Thanks.
_________________
Martin Prikryl
guest

Guest


prikryl wrote:
Thanks.

Hi Prikryl,

Did you get a chance to look into this issue?

If you can please help me with this issue, I will really appreciate it.

Thanks,
Anurag
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
guest wrote:
Did you get a chance to look into this issue?

If you can please help me with this issue, I will really appreciate it.

I've tried it on several different networks, and it works for me everywhere.
Do you know on what platform does the server, you access via UNC, run?
Also have you tried upgrading to the latest version of WinSCP? I do not think it would help, but just in case...
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
This issue has been added to tracker.
_________________
Martin Prikryl
larsonp
[View user's profile]

Joined: 2009-01-13
Posts: 3
I am having the same or similar problem with scripting.
I am using sftp to connect to a server, and attempting to download a file. I want to preserve the timestamp, so I use

Code:
get -preservetime /path/to/file/filename.txt G:\test\

Where G is a mounted network drive (NTFS, if it matters.)
And the transfer is successful, but the timestamp does not get set.

The same happens if G is changed to local drive C (NTFS, if it matters.)

The puzzling part, to me, is that if I use the GUI, and make sure the preserve timestamps box is checked, it works just fine. So, something is wrong with just the scripting version of get.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
So what is actual timestamp of downloaded file?
_________________
Martin Prikryl
larsonp
[View user's profile]

Joined: 2009-01-13
Posts: 3
prikryl wrote:
So what is actual timestamp of downloaded file?


The actual timestamp is the system time, whatever that happens to be.

If it helps to know, I'm using Windows XP. Is there anything else that would help?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
larsonp wrote:
The actual timestamp is the system time, whatever that happens to be.

If it helps to know, I'm using Windows XP. Is there anything else that would help?

I'll send you a debug version soon.
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24992
Location: Prague, Czechia
larsonp wrote:
I am having the same or similar problem with scripting.
I am using sftp to connect to a server, and attempting to download a file. I want to preserve the timestamp, so I use

Code:
get -preservetime /path/to/file/filename.txt G:\test\

Where G is a mounted network drive (NTFS, if it matters.)
And the transfer is successful, but the timestamp does not get set.

The same happens if G is changed to local drive C (NTFS, if it matters.)

The puzzling part, to me, is that if I use the GUI, and make sure the preserve timestamps box is checked, it works just fine. So, something is wrong with just the scripting version of get.

This bug has been added to tracker.
_________________
Martin Prikryl
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