Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the windows equivalent to the ln -s <target folder> <link folder> unix symbolic link command?

I'm attempting to follow the following tutorial for creating a program environment for the Twilio and App Engine library.

https://developers.google.com/appengine/articles/twilio

I'm good up until the point it says:

Link the Twilio library and its dependencies into your project:

$ ln -s venv/lib/python2.7/site-packages/twilio .

$ ln -s venv/lib/python2.7/site-packages/httplib2 .

$ ln -s venv/lib/python2.7/site-packages/six.py .

I've researched and it appears I'll be using something along the lines of

mklink /d venv\lib\python2.7\site-packages\twilio .

if I've understood correctly I basically need to understand what the "." stands for, as that is the target of the symbolic link? (Not certain about that.)

I'm using cmd.exe for the shell and could really use the help of someone that understands Unix better than I.

EDIT:

After reviewing my directory the path after venv is venv\lib\site-packages. There are already folders for Twilio and httplib2 at that point of the directory. Six exists at that point in a file named six.py.

Is the intent of the Unix command that I create a symbolic link from those existing folders to the working directory? Because what its doing is telling me I can't create existing files for both Twilio and httplib2. (There are already folders in the venv\lib\site-packages directory, and it WILL let me do a symlink for six, but then it recursively creates 4500 more layers deep of the entire six folder.)

like image 674
jmatthews Avatar asked Jun 22 '13 01:06

jmatthews


People also ask

What is ln command in Windows?

The ln command is a standard Unix command utility used to create a hard link or a symbolic link (symlink) to an existing file or directory. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk.

What is a symbolic link in Windows?

A symbolic link is a file-system object that points to another file system object. The object being pointed to is called the target. Symbolic links are transparent to users; the links appear as normal files or directories, and can be acted upon by the user or application in exactly the same manner.

What is symbolic link command in Unix?

A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system.


1 Answers

Try this :

mklink /D .\ venv\lib\python2.7\site-packages\httplib2

Note : mklink [OPTION] LINK TARGET (link and target are flipped compared to linux's ln -s)

Mklink Command Syntax :

MKLINK has 3 options /D, /H and /J. You also need to specify the path to the new symbolic link and the path to the original file or directory.

/D – used to create symbolic links for directories (d for directory)

/H – used to create hard links (h for hard link)

/J – used to create directory junction (j for junction)

By the way, always prefer mklink /D over mklink /J. Windows explorer will delete the entire contents of a junction (the latter) whereas when deleting a directory link (the former) it will just remove the link.

The dot . is the current directory (from where you are running the command). In the example above, I changed it to .\ to make it explicit.

For files : Helpful link.

If you can't get privilege with /D, use a hard link (option /H) :

mklink /H .\six.py venv\lib\python2.7\site-packages\six.py
like image 197
Gauthier Boaglio Avatar answered Oct 07 '22 20:10

Gauthier Boaglio