Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Retaining date modified on file transfers

Highlighted
bzdafro
Collector

Retaining date modified on file transfers

Hi,

I cannot believe I am stuck on this. I have an application that needs to retain the OS date modified on files being transferred, instead of the file transfer date (which is the way ksc_copy_server_server) performs. When we transfer a file with ksc_copy_server_server it uses VCP, but it does not use the -preserve switch to retain the file attributes. So it uses the current date & time. If I try to manually run "ksc_simple_respond "vcp -q -preserve -accepthostkeys -pw [DEST_ENV.SERVER_PASSWORD] "[P.P_FILENAME]" [DEST_ENV.SERVER_USERNAME]@[DEST_ENV.SERVER_NAME]:[P.P_FILENAME]" " " it echo's the password in the execution log. I cannot get it to suppress the password.

If I try "ksc_simple_respond "scp -pv "[P.P_FILENAME]" [DEST_ENV.SERVER_USERNAME]@[DEST_ENV.SERVER_NAME]:." -hide "assword:" "[DEST_ENV.SERVER_PASSWORD]" if fails with "Inappropriate ioctl for device
" I am copying from a windows server to a Sun server 5.10.

Has anyone run into this? If I had a way to pass the -preserve switch with the ksc_copy_server_server, that would work. However, I dont believe I can do that, even if I copy it into a new sc_ command. Any ideas would be appreciated.
3 REPLIES
Jim Esler
Honored Contributor

Re: Retaining date modified on file transfers

We use the expect command to execute scp when the server is not configured as an environment. The -p parameter could easily be specified this way to preserve the file creation and modification dates. If the password is specified on the command line call to the expect script, it is masked out in the log.
bzdafro
Collector

Re: Retaining date modified on file transfers

Not sure I understand. Do you have an example using the expect command?
Jim Esler
Honored Contributor

Re: Retaining date modified on file transfers

Here is a stripped down version of one of our command steps. I have not run this specific set of commands but it should give you the basic idea of the process:

ksc_begin_script /ITG/tmp/[SYS.USERNAME]_[REQ.REQUEST_ID]_scp.exp
#!/usr/bin/expect
set timeout -1
set server [lindex $argv 0]
set pw [lindex $argv 1]
if {$server=="" || $pw==""} {
puts "not enough args"
return 1
}
spawn scp -p source_file $server:dest_file
expect "assword: $"
send "$pw\n"
expect eof
set status [wait]
exit [lindex $status 3]
ksc_end_script

expect /ITG/tmp/[SYS.USERNAME]_[REQ.REQUEST_ID]_scp.exp "[REQD.P.SERVER]" "[REQD.P.PASSWORD]"
//Add this to "OnDomLoad" event