Symbolic Links Quick Reference

From TNG_Wiki
Jump to navigation Jump to search

Introduction

A symbolic link, also termed a soft link, is a special kind of file or folder that points to another file or folder, 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.

This reference only deals with folder symbolic links like a 'photos' folder link that, when you open it, appears to contain all the directories and files of the real target folder somewhere else on the system. And changes made here are reflected in the real folder. The icon for a folder symbolic link looks like a folder with a little arrow on it.

Ss001.png

Below we provide the syntax or code for creating a folder symbolic link on Windows 10, Linux and on your shared hosting website.

Windows 10 Command Line

  • Type cmd in the search box.
  • Right-click on Command Prompt
  • Select Run as administrator.
  • Navigate to directory where you want to create the symbolic link.

Syntax

mklink /D link_name real_target_folder

/D creates a directory symbolic link named link_name in current directory. It will point the real_target_folder.

Example

D:\documents> mklink /D link_folder "..\real_folder"

  • Note the quotes around the target path.
  • We are in the directory (documents) where we want to place the symbolic link.
  • We use the command mklink /D so we will be creating a directory symbolic link.
  • link_folder is the name of the directory symbolic link to create.
  • ../real_folder is the target whose contents will appear when you open link_folder