Creating shortcuts?

Paul Watson pwatson at redlinepy.com
Fri Jan 13 14:11:52 EST 2006


Ron Griswold wrote:
> Hi Dennis,
> 
> Yes, I am equating a unix soft link to a windows shortcut. Both act as
> links to a file or directory. 
> 
> I have found that windows shortcuts do appear in linux dir listings with
> a .lnk extension, however the file is meaningless to linux. On the other
> hand, a linux soft link does not appear in a windows directory listing,
> not that I really want it to.
> 
> As for os.link and os.symlink, these appear to be unix specific. It
> would be nice if os.symlink, when run on windows, would create a
> shortcut.
> 
> Thanks,
> 
> Ron Griswold
> Character TD
> R!OT Pictures
> rgriswold at rioting.com
> 
> 
> -----Original Message-----
> From: python-list-bounces+rgriswold=rioting.com at python.org
> [mailto:python-list-bounces+rgriswold=rioting.com at python.org] On Behalf
> Of Dennis Lee Bieber
> Sent: Friday, January 13, 2006 12:26 AM
> To: python-list at python.org
> Subject: Re: Creating shortcuts?
> 
> On Thu, 12 Jan 2006 22:53:42 -0800, "Ron Griswold"
> <RGriswold at Rioting.com> declaimed the following in comp.lang.python:
> 
> 
>>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...).
>>
> 
> 
> 	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)

UNIX links and Windows .lnk files are not the same thing.

Links on UNIX, both soft and hard, are known by the filesystem.

.lnk files on Windows are recognized by the OS as indicating that a 
different file is to be used.



More information about the Python-list mailing list