Mid-switch to Linux I realized I've a large personal and work archive that has over 1100 Windows Shortcuts(.lnk) of both files and folders and it is unusable without them and have been trying to figure out how to convert them to Linux Links and after familiarizing myself with the "ln" command I figured out how to get the NAME, TARGET and PATH for all of the shortcuts into a txt file using the program Shortcut Search and Replace. I then exported into Excel and formatted into something that looks like this, minus the categories on top:
NAME TARGET PATH PATH
0_Shortcut-name1 Library/Subject/Sub-folder_a/Sub-Sub-Folder Library/Subject/Sub-folder_b
0_Shortcut-name2 Library/Subject/Sub-folder_a/image.png Library/Subject/Sub-folder_b
0_Shortcut-name3 Library/Subject/Sub-folder_a/notes.txt Library/Subject/Sub-folder_b
0_Shortcut-name4 Library/Subject/Sub-folder_a/document.docx Library/Subject/Sub-folder_b
0_Shortcut-name5 Library/Subject/Sub-folder_a/document.pdf Library/Subject/Sub-folder_b
Note on the Excel formatting:
- Since we already have the Name of the shortcut in the first column, we need to remove that in addition to the .lnk that the raw Copy and Paste from 'Shortcut Search and Replace' will give us. Assuming your export in Excel puts Name, Target, Path in Columns A, B, C you would want to use this formula in column D(and drag it down) to do said formatting: =SUBSTITUTE(SUBSTITUTE(C1,"","@",LEN(C1)-LEN(SUBSTITUTE(C1,"",""))),RIGHT(SUBSTITUTE(C1,"","@",LEN(C1)-LEN(SUBSTITUTE(C1,"",""))),(LEN(C1)-FIND("@",SUBSTITUTE(C1,"","@",LEN(C1)-LEN(SUBSTITUTE(C1,"",""))))+1)),"")
Then you can use Find and Replace to remove Drive names and change the "" to a "/" as per Linux standards
IMPORTANT: You'll need to open the text file with a text editor under Linux that gives you the option of saving with a different line ending and you must choose Linux/Unix otherwise the wonderful scripts provided in the comments will not work. (They're delimited by a single tab in the txt file.)
Unfortunately, this is where my expertise ends and I would be delighted if a bash wizard were to write a script that does something like this:
1. Choose what location mnt/ something to append to the start of the address (before Library)
(bonus: Symbolic link by default, but have the option of choosing a hard link)
2. Open the file and Read Line 1
3. Get Path, CD to its location
4. Execute the "ln" Command to make a Symbolic link using NAME & TARGET PATH, creating the Hard/Sym link.
5+ Move on to Line 2 & Repeat until exhaustion of the list.
Solved
Massive thanks to Renaud Pacalet for providing this elegant piece of bash that solved my issues.
prefix='/mnt/'
while IFS=$'\t' read -r name target path; do
ln -s "$prefix$target" "$prefix$path/$name"
done < some/path/tab-separated-file
Posted by Renaud Pacalet
Retrieved 2025-11-06 License - CC BY-SA 4.0
P.S. There will inevitably be a few broken Links that you'll need to fix by hand, some due to the difference between Case Insensitive Windows and Case Sensitive Linux. In addition to that, names containing special symbols, break at some point in the formatting. I personally changed the code so as to make all of the shortcuts share the same Path, essentially make them all in the same folder so you can inspect which one is broken and why and then modify the text file to fix those issues and after everything is fixed I would run the code as intended.