overwrite files and preserve time stamp

Advertisement

techy
Guest

overwrite files and preserve time stamp

Hi all,

I seek your help in doing the following with the winscp command line script. I need to ftp the files port 22 with following option
- keep timestamp when writing the files
- overwrite the destination file if the the file name already exisits, when overwrite keep the source time-stamp

the options I have tired are
batch on
confirmation off
-perserve time

with this set of options when an existing file is overwritten, it give the time stamp at the time when the file was overwritten and not the timestamp of the file of source.

Please advise how I can achieve this

Regards,

ami9t

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: overwrite files and preserve time stamp

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

techy
Guest

Re: overwrite files and preserve time stamp

Hi,

I am sorry seems like didn't explain my issue correctly, I am not reporting a bug I am looking for command to do following. on a nightly basis we move files from source folder to a folder in destination server

1. IN the source folder lets say I have a file apple_one.txt (modified timestmap : july 23 11pm)
2.The same file already exist in the destination ( apple_one.txt (modified timestmap : july 22 5p pm)
3. Now when I run my put command with -batch on, confirmation off and -preserve timestamp
4. the destination files gets overwritten but the time stamp of the destination file is the time when I ran the command and is not the timestamp of the source file so final result is

in the destination folder I see appe_one.tx( modified timestamp : july 24 10pm) instead of july 23 11pm

Could you please advise if there is an option to do this

Regards,

amit

Reply with quote

martin
Site Admin
martin avatar

Re: overwrite files and preserve time stamp

I understand that. With options you mention you should achive the desired results. As you do not, I would like to see a log file to understand what's wrong.

Reply with quote

techy
Guest

Re: overwrite files and preserve time stamp

Matrin,
As you advised I am pasting you the portion of the log file for your analysis
--------------------------------------------------------------------------------------------
> 2009-07-30 00:28:49.677 Type: SSH_FXP_EXTENDED, Size: 63, Number: 200
. 2009-07-30 00:28:49.677 We will use UTF-8 strings when appropriate
. 2009-07-30 00:28:49.677 Getting current directory name.
. 2009-07-30 00:28:49.677 Getting real path for '.'
> 2009-07-30 00:28:49.677 Type: SSH_FXP_REALPATH, Size: 10, Number: 272
< 2009-07-30 00:28:49.708 Type: SSH_FXP_STATUS, Size: 57, Number: 200
. 2009-07-30 00:28:49.708 Discarding reserved response
< 2009-07-30 00:28:49.755 Type: SSH_FXP_NAME, Size: 19, Number: 272
. 2009-07-30 00:28:49.755 Real path is '/'
. 2009-07-30 00:28:49.755 Startup conversation with host finished.
. 2009-07-30 00:28:49.755 Cached directory change via "/FOLDER_NAME/steve_test/test_one" to "/FOLDER_NAME/steve_test/test_one".
. 2009-07-30 00:28:49.755 Getting current directory name.
. 2009-07-30 00:28:49.770 Copying 1 files/directories to remote directory "/FOLDER_NAME/steve_test/test_one"
. 2009-07-30 00:28:49.770 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (Yes); FnCs: N; RIC: 00; Resume: Y (102400); CalcS: No; Mask:
. 2009-07-30 00:28:49.770 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2009-07-30 00:28:49.770 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2009-07-30 00:28:49.770 File: "Copy of test2.txt"
. 2009-07-30 00:28:49.770 Copying "Copy of test2.txt" to remote directory started.
. 2009-07-30 00:28:49.770 Binary transfer mode selected.
. 2009-07-30 00:28:49.770 Checking existence of file.
> 2009-07-30 00:28:49.770 Type: SSH_FXP_LSTAT, Size: 63, Number: 519
< 2009-07-30 00:28:49.817 Type: SSH_FXP_ATTRS, Size: 105, Number: 519
. 2009-07-30 00:28:49.817 Checking existence of partially transfered file.
> 2009-07-30 00:28:49.817 Type: SSH_FXP_LSTAT, Size: 72, Number: 775
< 2009-07-30 00:28:49.849 Type: SSH_FXP_STATUS, Size: 62, Number: 775
< 2009-07-30 00:28:49.849 Status/error code: 2
. 2009-07-30 00:28:49.849 Opening remote file.
> 2009-07-30 00:28:49.849 Type: SSH_FXP_OPEN, Size: 85, Number: 1027
< 2009-07-30 00:28:49.911 Type: SSH_FXP_HANDLE, Size: 13, Number: 1027
> 2009-07-30 00:28:49.911 Type: SSH_FXP_WRITE, Size: 34, Number: 1542
> 2009-07-30 00:28:49.911 Type: SSH_FXP_CLOSE, Size: 13, Number: 1796
< 2009-07-30 00:28:49.942 Type: SSH_FXP_STATUS, Size: 34, Number: 1542
< 2009-07-30 00:28:49.989 Type: SSH_FXP_STATUS, Size: 34, Number: 1796
< 2009-07-30 00:28:49.989 Status/error code: 0
> 2009-07-30 00:28:49.989 Type: SSH_FXP_REMOVE, Size: 59, Number: 2061
< 2009-07-30 00:28:50.036 Type: SSH_FXP_STATUS, Size: 34, Number: 2061
< 2009-07-30 00:28:50.036 Status/error code: 0
> 2009-07-30 00:28:50.036 Type: SSH_FXP_RENAME, Size: 122, Number: 2322
< 2009-07-30 00:28:50.083 Type: SSH_FXP_STATUS, Size: 34, Number: 2322
< 2009-07-30 00:28:50.083 Status/error code: 0
> 2009-07-30 00:28:50.083 Type: SSH_FXP_SETSTAT, Size: 84, Number: 1289
< 2009-07-30 00:28:50.114 Type: SSH_FXP_STATUS, Size: 49, Number: 1289
< 2009-07-30 00:28:50.114 Status/error code: 8, Message: 1289, Server: The request is not supported. , Language: en
* 2009-07-30 00:28:50.114 (ETerminal) The server does not support the operation.
* 2009-07-30 00:28:50.114 Error code: 8
* 2009-07-30 00:28:50.114 Error message from server (en): The request is not supported.
* 2009-07-30 00:28:50.114 Request code: 9
. 2009-07-30 00:28:50.114 Asking user:
. 2009-07-30 00:28:50.114 Upload of file 'Copy of test2.txt' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permission errors' option. ("The server does not support the operation.
. 2009-07-30 00:28:50.114 Error code: 8
. 2009-07-30 00:28:50.114 Error message from server (en): The request is not supported.
. 2009-07-30 00:28:50.114 Request code: 9")
* 2009-07-30 00:29:53.819 (EScpSkipFile) Upload of file 'Copy of test2.txt' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permission errors' option.
* 2009-07-30 00:29:53.819 The server does not support the operation.
* 2009-07-30 00:29:53.819 Error code: 8
* 2009-07-30 00:29:53.819 Error message from server (en): The request is not supported.
* 2009-07-30 00:29:53.819 Request code: 9

Reply with quote

Advertisement

techy
Guest

matrin,

Please advise .. on the issue I have pasted the log above. Please let me know if any addtional information is requried

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: overwrite files and preserve time stamp

techy wrote:

> 2009-07-30 00:28:50.083 Type: SSH_FXP_SETSTAT, Size: 84, Number: 1289
< 2009-07-30 00:28:50.114 Type: SSH_FXP_STATUS, Size: 49, Number: 1289
< 2009-07-30 00:28:50.114 Status/error code: 8, Message: 1289, Server: The request is not supported. , Language: en
* 2009-07-30 00:28:50.114 (ETerminal) The server does not support the operation.
* 2009-07-30 00:28:50.114 Error code: 8
* 2009-07-30 00:28:50.114 Error message from server (en): The request is not supported.
* 2009-07-30 00:28:50.114 Request code: 9
I guess it is almost self-explanatory. Your server does not support setting file attributes, including timestamp.

Reply with quote

techy
Guest

Re: overwrite files and preserve time stamp

Martin,

Could you please advise what options we have to resolve this, when you said our server doesn't support that means it could be the policies of the server we are using windows 2003 server on both sides ( source and destination)

Reply with quote

martin
Site Admin
martin avatar

Re: overwrite files and preserve time stamp

It is not about Operating system, but about SFTP server. I do not know what yours one is (Windows does not include any SFTP server). Even if I do, I would be able to help you as the only SFTP server I know good enough is OpenSSH and it does support that. So I suppose you use different one.

Reply with quote

Advertisement

Chris N
Guest

Re: Overwrite files and preserve timestamp

Prikryl said: guess it is almost self-explanatory. Your server does not support setting file attributes, including timestamp.

If this is your problem and you are getting error code 8 (the request is not supported) This is what I did to fix it.

View | Preferences | Transfer
check "Ignore permission errors"
uncheck "Preserve Timestamp"

This is how I did it with GUI. If you are using the command line, first make the changes from GUI, then check the configuration file for the correct syntax.

Chris

Reply with quote

Chris N
Guest

Re: Overwrite files and preserve timestamp

In the WinSCP.ini file this is what the changes I made above look like

[Configuration\Interface\CopyParam]
IgnorePermErrors=1
PreserveTime=0

Chris

Reply with quote

Rich_44
Guest

WinScp Error

when doing uploads I get this error: Upload of file EL_KC20120719000337.txt was successful,but the error occurred while setting the permissions and/or timestamp. If the problem persists, turn on Ignore permissions erros' option.

can someone help me out with this?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: WinScp Error

Rich_44 wrote:

when doing uploads I get this error: Upload of file EL_KC20120719000337.txt was successful,but the error occurred while setting the permissions and/or timestamp. If the problem persists, turn on Ignore permissions erros' option.
Please read documentation:
https://winscp.net/eng/docs/faq_not_owner

If that does not help, come back.

Reply with quote

Advertisement

You can post new topics in this forum