Creating shortcuts?

Discussion in 'Python' started by Ron Griswold, Jan 13, 2006.

  1. Ron Griswold

    Ron Griswold Guest

    Hi Folks,

    Is it possible to create a shortcut to a file in Python? I need to do
    this in both win32 and OSX. I've already got it covered in Linux by
    system(ln...).

    Thanks,

    Ron Griswold
    Character TD
    R!OT Pictures
     
    Ron Griswold, Jan 13, 2006
    #1
    1. Advertisements

  2. Are you equating a Windows "shortcut" to a Unix "link"? Soft link,
    at that, I suspect -- as a hard link can be done using os.link(), though
    a soft link can be done with os.symlink(). Lets see if my terminology is
    correct: a "hard link" is an additional directory entry pointing to a
    pre-existing file (with a count of how many entries exist for the file);
    a "soft link" is basically a special file that contains the full path to
    the actual file (and hence, could cross file system boundaries).

    I don't think Windows "shortcuts" are the same thing (as my memory
    struggles, I have vague inklings that NTFS actually supports Unix-like
    links, but practically nothing uses them). At best, they may be similar
    to a soft link, being a particular type of file, being that they are
    files with a ".lnk" extension (and hidden by the OS normally)


    --
     
    Dennis Lee Bieber, Jan 13, 2006
    #2
    1. Advertisements

  3. Ron Griswold

    Roger Upole Guest

    On Windows, Pywin32 allows you to create and manipulate
    shortcuts. See \win32comext\shell\test\link.py for a small
    class that wraps the required interfaces.
    hth
    Roger

    Hi Folks,

    Is it possible to create a shortcut to a file in Python? I need to do
    this in both win32 and OSX. I've already got it covered in Linux by
    system(ln...).

    Thanks,

    Ron Griswold
    Character TD
    R!OT Pictures
     
    Roger Upole, Jan 13, 2006
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.