win32api.FindFiles Win2003, problem with Short Name

Discussion in 'Python' started by Frank Borell, Oct 14, 2005.

  1. Frank Borell

    Frank Borell Guest

    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
     
    Frank Borell, Oct 14, 2005
    #1
    1. Advertising

  2. Frank Borell

    Neil Hodgson Guest

    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
     
    Neil Hodgson, Oct 14, 2005
    #2
    1. Advertising

  3. Frank Borell

    Frank Borell Guest

    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
     
    Frank Borell, Oct 14, 2005
    #3
  4. Frank Borell

    Neil Hodgson Guest

    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 Hodgson, Oct 15, 2005
    #4
  5. Frank Borell

    Frank Borell Guest

    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
     
    Frank Borell, Oct 17, 2005
    #5
  6. Frank Borell

    Neil Hodgson Guest

    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
     
    Neil Hodgson, Oct 18, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Geering

    longs, long longs, short short long ints . . . huh?!

    David Geering, Jan 8, 2007, in forum: C Programming
    Replies:
    15
    Views:
    595
    Keith Thompson
    Jan 11, 2007
  2. Replies:
    4
    Views:
    867
    Kaz Kylheku
    Oct 17, 2006
  3. Ioannis Vranos

    unsigned short, short literals

    Ioannis Vranos, Mar 4, 2008, in forum: C Programming
    Replies:
    5
    Views:
    732
    Eric Sosman
    Mar 5, 2008
  4. Moshe Katz
    Replies:
    1
    Views:
    101
    Grant Wagner
    May 6, 2004
  5. Andre
    Replies:
    5
    Views:
    565
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page