By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,403 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,403 IT Pros & Developers. It's quick & easy.

win32api.FindFiles Win2003, problem with Short Name

P: n/a
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;
print win32api.FindFiles(process_source_dir + "*")


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

Oct 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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
Oct 14 '05 #2

P: n/a
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

Oct 14 '05 #3

P: n/a
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
Oct 15 '05 #4

P: n/a

Neil Hodgson wrote:
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


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

Oct 17 '05 #5

P: n/a
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
Oct 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.