What is the file extension for a symbolic link?

martinlest

New member
Power User
VIP
Local time
7:38 AM
Messages
661
I want to write a batch script which backs up folders (no problem) but which will ignore symbolic links (shortcuts) in those folders (problem! Simply because I don't know what the file extension is to write the exclude into the script: it isn't '.lnk'). I didn't find the answer after Googling either.

Anyone know how I can do this (I use XXCopy BTW)
 

My Computer My Computer

At a glance

Windows 7 Home Premium SP1 64-bitIntel Core i7-4790K CPU @ 4.5GHz16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz8GB NVIDIA GEFORCE GTX 1070
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Home Premium SP1 64-bit
CPU
Intel Core i7-4790K CPU @ 4.5GHz
Motherboard
Asus H97I-PLUS
Memory
16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz
Graphics Card(s)
8GB NVIDIA GEFORCE GTX 1070
Monitor(s) Displays
HannsG 28" & Dell 24"
Screen Resolution
1920x1200
Hard Drives
1 x 2TB Samsung Evo 860 SSD
2 x 500GB Samsung Evo 850 SSD
PSU
CORSAIR 650W CS SERIES
Case
Thermaltake Core V1 Mini ITX Cube
Cooling
NOCTUA NH-L12
Browser
Firefox
Other Info
Custom PC used for X-Plane 11
Not directly but if you take a look on Microsoft's Sysinternals site there are a few utilities, (including some CMD capable), that may allow you to do what you wish

There is a full set of corresponding documentation that is in good depth
 

My Computers My Computers

  • At a glance

    Windows 11 Pro x64 [Latest Release and Releas...Ryzen 9 5950X, 3.8 - 5.2 MHz64GB [2 x 32GB] DDR4 3200MHz4GB NVIDIA GEFORCE GTX 1650 Ti
    Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • At a glance

    Windows 11 Pro x64 Latest RPIntel I7 10750H 5.0GHz32GB [2x16GB] DDR4 2933 MHznVidia GTX1650Ti 4 GB GDDR6
    Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
Thanks. I already use a number of little programmes from Sysinternals, but I am not sure which one you were thinking of with regard to including symlinks in batch scripts?

Perhaps I just use the address of the folders/files to which the symlinks connect?
 

My Computer My Computer

At a glance

Windows 7 Home Premium SP1 64-bitIntel Core i7-4790K CPU @ 4.5GHz16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz8GB NVIDIA GEFORCE GTX 1070
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Home Premium SP1 64-bit
CPU
Intel Core i7-4790K CPU @ 4.5GHz
Motherboard
Asus H97I-PLUS
Memory
16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz
Graphics Card(s)
8GB NVIDIA GEFORCE GTX 1070
Monitor(s) Displays
HannsG 28" & Dell 24"
Screen Resolution
1920x1200
Hard Drives
1 x 2TB Samsung Evo 860 SSD
2 x 500GB Samsung Evo 850 SSD
PSU
CORSAIR 650W CS SERIES
Case
Thermaltake Core V1 Mini ITX Cube
Cooling
NOCTUA NH-L12
Browser
Firefox
Other Info
Custom PC used for X-Plane 11
Have you tried using powershell to view it?
Probably like unix ls?

Also, are you sure xcopy is backing up symbolic links?
 

My Computer My Computer

At a glance

windows 7 64biti7-2600k8gb680tx in sli
Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom build
OS
windows 7 64bit
CPU
i7-2600k
Motherboard
Asus p8z77-v deluxe
Memory
8gb
Graphics Card(s)
680tx in sli
Hard Drives
samsung 840 ssd 240 Gb and seagate 2Tb (data) and WD Red 2TB (backup)
Antivirus
Norton 360
Browser
Chrome and firefox
Have you tried using powershell to view it?
Sorry, I think we are at crossed purposes. To view what? This is really about script writing. I want to exclude any symbolic links in a folder when writing a batch script, but I don't know how to specify symlinks.

For instance:

/X"C:\New Folder\*.lnk"

would exclude any normal shortcuts. But it won't exclude sympbolic links.
 

My Computer My Computer

At a glance

Windows 7 Home Premium SP1 64-bitIntel Core i7-4790K CPU @ 4.5GHz16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz8GB NVIDIA GEFORCE GTX 1070
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Home Premium SP1 64-bit
CPU
Intel Core i7-4790K CPU @ 4.5GHz
Motherboard
Asus H97I-PLUS
Memory
16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz
Graphics Card(s)
8GB NVIDIA GEFORCE GTX 1070
Monitor(s) Displays
HannsG 28" & Dell 24"
Screen Resolution
1920x1200
Hard Drives
1 x 2TB Samsung Evo 860 SSD
2 x 500GB Samsung Evo 850 SSD
PSU
CORSAIR 650W CS SERIES
Case
Thermaltake Core V1 Mini ITX Cube
Cooling
NOCTUA NH-L12
Browser
Firefox
Other Info
Custom PC used for X-Plane 11
There is no such thing as an "extension" for symbolic links (or hard links, or junctions, for that matter). They're NOT just plain files, they're special file system objects that behave differently than anything else. They only exist on NTFS, where the file system can hold their special properties, but not on FAT32 for example. As such, you can't rely on an "extension" to identify them.

In contraposition, shortcuts are just normal files with a particular format, not different to .txt, .mp3 or .xls. Windows Explorer understands its format and uses it to find another file, that's all about them. It's a convention that they use a .lnk extension. Windows Explorer purposely hide this away, even when told not to, but any decent file manager (including a plain old dir command) can show it.

Back to the topic, if you want a way to exclude them, you need to identify them beforehand. The only feature in XCOPY that mentions them is the /B switch that copies the link itself instead of duplicating the target (it makes no mention of junctions and hard links, however). I looked that at this reference.

I found this post at SuperUser talking about a similar issue:
windows 7 - How to view all the Symbolic links,Junction points,Hard links in a Folder using dir? - Super User

This shows different ways to view the symbolic links. Focus on those that suggest command line tools, as their output can be used for further processing, including feeding XCOPY an adequate exclusion list. I personaly like the PowerShell alternative, showing all types of special file system objects. That should serve you well to script the backup.
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64Intel Core i7-740QM8 GB DDR3NVIDIA GeForce 330GT
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
Thanks for the reply. I use XXCopy or (Robocopy sometimes) and for now I can exclude the symlink targets from being backed up (over 3TBs of data in all) as they all have a part of the file name in common - so with some wildcard characters that works.

I'll have a look at the links you posted of course - thanks again for the information.
 

My Computer My Computer

At a glance

Windows 7 Home Premium SP1 64-bitIntel Core i7-4790K CPU @ 4.5GHz16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz8GB NVIDIA GEFORCE GTX 1070
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Home Premium SP1 64-bit
CPU
Intel Core i7-4790K CPU @ 4.5GHz
Motherboard
Asus H97I-PLUS
Memory
16GB KINGSTON HYPER-X FURY DUAL-DDR3 1600MHz
Graphics Card(s)
8GB NVIDIA GEFORCE GTX 1070
Monitor(s) Displays
HannsG 28" & Dell 24"
Screen Resolution
1920x1200
Hard Drives
1 x 2TB Samsung Evo 860 SSD
2 x 500GB Samsung Evo 850 SSD
PSU
CORSAIR 650W CS SERIES
Case
Thermaltake Core V1 Mini ITX Cube
Cooling
NOCTUA NH-L12
Browser
Firefox
Other Info
Custom PC used for X-Plane 11
Back
Top