Unicode support in Command prompt

G

Guest

I have these strange unicode characters in some of my filenames on a Win2K
server. Win2K server recognizes them well and they come up fine in windows
explorer. The problem comes when I try to access them in a command prompt. I
have to backup these files everyday. So, I'm trying to write some script to
do it. Command prompt doesn't understand these characters and so I couldn't
copy them from cmd. I can copy them from windows explorer. I would like to
know how to enable this character support in command prompt or in that
environment. Or is there any other way of copying these files other than from
cmd prompt environ? I'm talking about few hundred files and directories.

I'd really appreciate your thoughts.
 
O

Olof Lagerkvist

Sanjay said:
I have these strange unicode characters in some of my filenames on a Win2K
server. Win2K server recognizes them well and they come up fine in windows
explorer. The problem comes when I try to access them in a command prompt. I
have to backup these files everyday. So, I'm trying to write some script to
do it. Command prompt doesn't understand these characters and so I couldn't
copy them from cmd. I can copy them from windows explorer. I would like to
know how to enable this character support in command prompt or in that
environment. Or is there any other way of copying these files other than from
cmd prompt environ? I'm talking about few hundred files and directories.

Command Prompt does not support Unicode so you need a
backup/copy/archive tool that supports Unicode.

You can use ntbackup to backup the files to a backup archive or
robocopy.exe from the Resource Kit to copy them to another directory.

I have also written a tool that supports Unicode and all other special
file information in NT/2K/XP called strarc (Stream Archiver) that can be
used to copy a directory tree to another directory or to backup a
directory tree to an archive file. It is available here:
http://here.is/olof/w32apps.htm
 
G

Guest

Thank you Olof. I haven't tried the tool on your website yet. I will do
that. Before I do that I have a question. I am copying this win2k server
volume to a JFS storage box attached to a linux box. This storage box is
mapped to the win2k server via samba, so it can see the storage box. Will
your tool work fine for this kind off transfer? And another question is, will
it handle hundreds of gigs of data ??? 'cos our win2k server volume is of
that magnitude.

Thanks a ton,
 
O

Olof Lagerkvist

Sanjay said:
Thank you Olof. I haven't tried the tool on your website yet. I will do
that. Before I do that I have a question. I am copying this win2k server
volume to a JFS storage box attached to a linux box. This storage box is
mapped to the win2k server via samba, so it can see the storage box. Will
your tool work fine for this kind off transfer?

Yes, but Samba as server may be a little different compared to Windows.
If you copy files to an NTFS volume on another Windows box using e.g.
robocopy or my strarc you can copy the files including all metadata,
such as security information, attributes, alternate data streams etc and
much of this information cannot be stored on a Linux filesystem.
However, using Microsoft's ntbackup or my strarc you can create a big
archive file that includes all this information about the files and then
store that archive file anywhere, like:
strarc -c -d:D:\DirectoryToBackup \\server\share\BigArchiveFile

Also note that very old versions of Samba did not handle files over 4 GB
in size.
And another question is, will
it handle hundreds of gigs of data ??? 'cos our win2k server volume is of
that magnitude.

As far as I have tested, yes.
 
G

Guest

Hi Olof,

Thank you I'm using your strarc program. It was able to read most of the
chars but failed on couple of them. This is what I'm doing

c:\> strarc -cjd:dirpath | strarc -xd:destdirpath

It is throwing a warning/error msg for almost every file in the dirpath (it
just a variable that I used here, actually I'm typing the complete path of
the dir at hte command prompt). Some says file already exists, some says
access is denied and system cannot find hte specified path etc.

And does your program is capable of deleting files in the dest dir that are
not there in the source dir, kinda like rsync. And how would I do a
differential backup for 5 days a week. Could you give me the required options
to make this work?

TIA
 
O

Olof Lagerkvist

Sanjay said:
Hi Olof,

Thank you I'm using your strarc program. It was able to read most of the
chars but failed on couple of them. This is what I'm doing

c:\> strarc -cjd:dirpath | strarc -xd:destdirpath

It is throwing a warning/error msg for almost every file in the dirpath (it
just a variable that I used here, actually I'm typing the complete path of
the dir at hte command prompt). Some says file already exists, some says
access is denied and system cannot find hte specified path etc.

Does it actually copy the files anyway (just warning messages) or does
it completely refuse to copy the files? Note that if the error message
says that the file already exists that means you have not told strarc to
overwrite existing files, use the -o switch for that.

If you are copying to a Samba server or to some other non-NTFS
destination some error messages may tell that not all meta-data can be
restored, like security descriptors, some attributes or alternate
streams etc. It is better in this case to create a backup archive file
instead of copying files to a new directory tree, e.g.:

c:\> strarc -cjd:dirpath destdirpath\archive.sa

With a backup archive file you will never lose any backed up information
because of limitations of the filesystem where you store the backup.
And does your program is capable of deleting files in the dest dir that are
not there in the source dir, kinda like rsync.

No, sorry I have not included such features and I am not currently
planning to do so. Maybe in the future if more users ask for it or I may
create a special release if someone shares modified source code with
such features added.
And how would I do a
differential backup for 5 days a week. Could you give me the required options
to make this work?

I have some samples in the text file that is included in strarc.zip, but
basically expained, you use the -m (method) switch. First you create a
full backup:

strarc -cjd:dirpath -m:f | strarc -xod:destpath

This will clear archive attributes on the backed up files. Then on the
other weekdays you do a differential backup:

strarc -cjd:dirpath -m:d | strarc -xod:destpath

This will backup all files with archive attribute set without clearing
the archive attributes.

But if you consider creating backup archive files instead of copying:

strarc -cjd:dirpath -m:f destpath\backup_full.sa
and then
strarc -cjd:dirpath -m:d destpath\backup_monday.sa
strarc -cjd:dirpath -m:d destpath\backup_tuesday.sa
etc...

To restore from such backup archives first restore the full backup:
strarc -xd:dirpath destpath\backup_full.sa
Then the diff archives:
strarc -xd:dirpath -o:a destpath\backup_monday.sa
strarc -xd:dirpath -o:a destpath\backup_tuesday.sa
etc...

You can also create a full backup archive file and then append the diff
backups to that archive file to make restore operation easier, using the
-a (append) switch. First the full backup without -a (overwriting, new
archive):
strarc -cjd:dirpath -m:f destpath\backup.sa
then the diff backups with -a (appending to archive):
strarc -cajd:dirpath -m:d destpath\backup.sa

To restore such an archive you just need one line:
strarc -xd:dirpath -o:a destpath\backup.sa
This will extract first the full backup and then overwrite with the
differences from the other days. You will lose the possibility to
restore up to a given weekday with this method but on the other hand you
can use exactly the same command to restore the most recent backup
regardless of which weekday backup is most recent.
 
G

Guest

Where can I get the source code for this program??? If I get a chance to I
will look into adding the syncing feature that I mentioned.

So, if it doesn't delete the files that are deleted on the source directory
then how would you restore the directory to the current status from the
backup???

Thank you
 
O

Olof Lagerkvist

Sanjay said:
Where can I get the source code for this program??? If I get a chance to I
will look into adding the syncing feature that I mentioned.

It is included in a source archive containing source to some other of my
tools and ports as well, about 1 MB.
http://here.is/olof/files/source.tar.lzma

The subdirectory for strarc in the archive is win32\strarc and it uses
some header files from win32\include and libs from win32\lib.

It is a tar archive compressed using lzma.exe (available in the 7-zip
source archive at http://www.7-zip.org or stand-alone at my site:
http://here.is/olof/files/lzma.exe ).
So, if it doesn't delete the files that are deleted on the source directory
then how would you restore the directory to the current status from the
backup???

I create a new backup archive file for each backup instance and I
usually name the archive files according to date and time for the
backup. That means that each backup archive file contains only files
that existed when that backup ran so I can restore individual files with
the -i switch or the entire archive after a disk crash etc.

However, you are right in cases of differential or incremental backups.
Because no information is backed up about files deleted between the full
backup and the last differential or each incremental backup those
deleted files will still exist after a restore operation if they exist
in the full backup archive or in a previous incremental archive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top