Is there any option in get command to preserve the time

Advertisement

guest
Guest

Is there any option in get command to preserve the time

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

Reply with quote

Advertisement

guest
Guest

Re: Is there any option in get command to preserve the time

martin wrote:

There's preserve timestamp 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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: Is there any option in get command to preserve the time

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.

Reply with quote

guest
Guest

Re: Is there any option in get command to preserve the time

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: Is there any option in get command to preserve the time

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.

Reply with quote

Guest

Re: Is there any option in get command to preserve the time

martin 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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: Is there any option in get command to preserve the time

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.

Reply with quote

Guest

Re: Is there any option in get command to preserve the time

martin wrote:

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Is there any option in get command to preserve the time

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?

Reply with quote

anurag_kapoor
Joined:
Posts:
2
Location:
San Jose

Re: Is there any option in get command to preserve the time

martin 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

Reply with quote

martin
Site Admin
martin avatar

Re: Is there any option in get command to preserve the time

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?

Reply with quote

anurag_kapoor
Joined:
Posts:
2
Location:
San Jose

Re: Is there any option in get command to preserve the time

martin 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

Reply with quote

Advertisement

guest
Guest

Re: Is there any option in get command to preserve the time

martin 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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: Is there any option in get command to preserve the time

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

Reply with quote

Advertisement

larsonp
Joined:
Posts:
3

still not working?

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

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.

Reply with quote

larsonp
Joined:
Posts:
3

Re: still not working?

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: still not working?

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: still not working?

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

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.

Reply with quote

Advertisement

You can post new topics in this forum