Tuesday, February 24, 2009

Copy data from UNIX to Windows, keeping structure and timestamp


We are migrating our FTP server from UNIX, Tru64 to a Windows box, Server 2008.
We want to keep the structure and timestamp.

First tried tar.gz, thinking that Server 2008 is smart enough to be able to handle it, without me doing any trick.
No. It does not recognize .gz nor .tar. BTW, I did not give a try to the SUA, subsystem for UNIX-base application.
Since it is already a production server. I wanted to do it as simply as possible. Without installing anything.

I tried the GNU tar, which you do not have to really “install”, just have the executable.
Funnily, the timestamp is not preserved. The date is OK but time changes. We can easily guess that, in which case the time is not really OK either.
Some difference in ways to store datetime info, probably. I did not digg it further.

Then went for ZIP. I should have tried it first. Both platform claim that they support it natively. It was just that I do not use it often.

On UNIX, I zipped the folder structure, just normally without specifying any special option,

% zip -r (resulting zipfile) (folder to archive)
# This is just for me to remember the syntax. The man entry was not so easy to understand...

copied it over to Windows, and simply did the Extract All from the Right-Click menu.
This time, the timestamp of files are OK but not for folders. It appears that folders are created while it unarchives.
Looking into the zip file, without extracting it, shows that the dates are there. So it is just a problem with unarchiving, not with the way the zip file is created.

As far as my research goes, Windows 2008 does not seem to have a command line interface for unzip.
I found one at
http://www.info-zip.org/Info-ZIP.html. Seems a dicent project. Downloaded it and finally my folder timestamps are there!!


No comments: