win32api.FindFiles Win2003, problem with Short Name

F

Frank Borell

I'm having a problem retrieving the ShortName from a file that was
written by a MAC and only from a Windows 2003 server.

I realize the file has a space after it, but I can retrieve the short
name from Windows XP and 2000;

Excluding the results from "." and "..", it returns:
(32, <PyTime:10/13/2005 8:12:12 PM>, <PyTime:10/13/2005 8:41:40 PM>,
<PyTime:10/13/2005 8:16:56 PM>, 0, 44118, 29741111, 0, '10^2f16
Hardcover a ', '10^2F167.5AC') - All OK!!

When using the same command on Win2003, it returns:
<PyTime:10/13/2005 8:49:06 PM>, <PyTime:10/13/2005 8:16:56 PM>, 0,
44118, 29741111, 0, '10^2f16 Hardcover a ', '')

The versions of Python / Win32 are the same on all servers.
Does anyone have any ideas?

Frank
 
N

Neil Hodgson

Frank Borell:
I'm having a problem retrieving the ShortName from a file that was
written by a MAC and only from a Windows 2003 server.

I realize the file has a space after it, but I can retrieve the short
name from Windows XP and 2000;

Does your Windows 2003 machine have short file name support turned
off? The NtfsDisable8dot3NameCreation registry option is popular with
some administrators.

Neil
 
F

Frank Borell

Neil,

On all three types of PC/Servers they are set to 0.

For now I'll have to process this script on non 2003 servers?!?

Thanks,

Frank
 
N

Neil Hodgson

Frank Borell:
On all three types of PC/Servers they are set to 0.

For now I'll have to process this script on non 2003 servers?!?

What do you get if you call win32api.GetShortPathName on the long name?

Neil
 
F

Frank Borell

Neil said:
Frank Borell:

What do you get if you call win32api.GetShortPathName on the long name?

Neil

Neil,

It seems I'm in a catch 22.

My initial issue was trying to rename/move files on a SAN that were
written from Mac's. While the easier messed up files names were easy to
convert and move, I quickly came across a few types that were not.
Files with spaces at the end seemed to only be solved with the
win32api.FindFiles(fullpath + '*').

The catch 22:
All other commands reported the path structure but the output could not
be used because Python/the system reported that it could not find the
file/path specified. (Including GetShortName).

Unfortunately I've been testing on an XP with all working fine, the
Win2003 simply does not show anything on the SAN for FindFiles(last
tuple).

It DOES show shortnames for other directories like 'c:/python24/lib'

Win2003 on ''c:/python24/lib'

Original Name | Short Name

aifc.py|
anydbm.py|
asynchat.py|
asyncore.py|
atexit.py|
atexit.pyc|
audiodev.py|
base64.py|
base64.pyc|
BaseHTTPServer.py|BASEHT~1.PY
Bastion.py|


WinXP on SAN:

Original Name | Short Name

^2aCOSBY SON PROFILE^2fNYT18|A^2ACOSB.1A7
Jimmy Carter|JIMMY_CF.86A
Allende's Last Day-jpgd.|ALLENDEC.9D3
archives 1959|ARCHIVE6.330
Barbara Jordan|BARBARAF.714
Bettmann-Mine 24.6mgs|BETTMAN7.D79
Bosley Crowther 16-095.jpg|BOSLEY_F.148
Calvin Klein.jpg|CALVIN_5.0B1
Carl Erskine Bkyln Dodger.jpg|CARL_ER8.683

Win2003 on SAN:

Original Name | Short Name

A^2aCOSBY SON PROFILE^2fNYT18|
Jimmy Carter|
Allende's Last Day-jpgd.|
archives 1959|
Barbara Jordan|
Bettmann-Mine 24.6mgs|
Bosley Crowther 16-095.jpg|
Calvin Klein.jpg|
Carl Erskine Bkyln Dodger.jpg|
Chess^2fConrad|
Coco Chanel portrait 18-940.jpg|
Coco Chanel1 18-940.jpg|


Frank
 
N

Neil Hodgson

Frank Borell:
My initial issue was trying to rename/move files on a SAN that were
written from Mac's.

I've never used a SAN. It is possible that it has its own name
system and what you are seeing is the result of different views of that.
> While the easier messed up files names were easy to
convert and move, I quickly came across a few types that were not.
Files with spaces at the end seemed to only be solved with the
win32api.FindFiles(fullpath + '*').

Does performing a dir /X from the command line show the short names
from the 2003 system? If so it means that there are APIs capable of
finding the information so I'd be trying to use ctypes to call the
underlying wide character FindFirstFileExW function.
^2aCOSBY SON PROFILE^2fNYT18|A^2ACOSB.1A7

This was hex escaped from *COSBY SON PROFILE/NYT18.

Neil
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,166
Latest member
DollyBff32
Top