[Tutor] symlinking dirs with spaces

Steven D'Aprano steve at pearwood.info
Sun Apr 28 03:38:49 CEST 2013


On 28/04/13 04:53, fomcl at yahoo.com wrote:

> IIRC, os.symlink is not present in Python on Windows, right? (I'm on vacation now so I can't check this). But aren't soft links and shortcuts linux and windows terms for the same thing?

No, although they play similar roles.

Windows shortcuts are ordinary files with a .lnk extension. The content of the file points to another file on disk. Windows opens the file, looks inside to find out what target to look for, then looks for the target. That makes them somewhat like Mac OS aliases, only not as smart. (Mac aliases can actually keep tracking a file if you move it from location to location, even from disk to disk.)

Symbolic (soft links) links are file system features, which means that strictly speaking they depend on the file system, not the operating system. Unlike shortcuts or aliases, which are files, sym links exist in the file system metadata, which makes them smaller, faster to access, and more efficient.

Hard links are also file system features. Essentially, a hard link is a way to give a single file two names. If you think of the file system as a tree of file names pointing to storage locations on disk, hard links are two names pointing to a single location.

A little known fact: NTFS does support symbolic links, at least under Windows 7 and Vista. NTFS sym links have some limitations compared to POSIX (Unix, Mac, Linux, etc.) sym links, the biggest being that they don't work during boot-up.



-- 
Steven


More information about the Tutor mailing list