Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: What is the file extension for a symbolic link?

04 Feb 2018   #1
martinlest

Windows 7 Home Premium SP1 64-bit
 
 
What is the file extension for a symbolic link?

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 System SpecsSystem Spec
.
04 Feb 2018   #2
Barman58

Windows 10 Pro x64 x3, Ubuntu
 
 

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 System SpecsSystem Spec
05 Feb 2018   #3
martinlest

Windows 7 Home Premium SP1 64-bit
 
 

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 System SpecsSystem Spec
.

06 Feb 2018   #4
chitownbob

windows 7 64bit
 
 

Have you tried using powershell to view it?
Probably like unix ls?

Also, are you sure xcopy is backing up symbolic links?
My System SpecsSystem Spec
06 Feb 2018   #5
martinlest

Windows 7 Home Premium SP1 64-bit
 
 

Quote:
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 System SpecsSystem Spec
09 Mar 2018   #6
Alejandro85

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
09 Mar 2018   #7
martinlest

Windows 7 Home Premium SP1 64-bit
 
 

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 System SpecsSystem Spec
Reply

 What is the file extension for a symbolic link?




Thread Tools




Similar help and support threads
Thread Forum
Sort order of Directory Symbolic Link
I've just moved a directory from C:\Users\Steve\Documents\Probate to \\PROLIANT\Probate (a share on my WHS2011 server). I created a Symbolic Directory link from \\PROLIANT\Probate in C:\Users\Steve\Documents, but when I view the "Documents" folder, the symbolic link sorts amongst the files...
General Discussion
Change folder/file location - use Move, Symbolic link or Junction?
I've finished a new build that uses a SSD as the system drive (and some programs) and has a secondary HDD. I'm just getting ready to add programs and move data (documents, photos, music, etc.) to the new system. First time SSD user and have done most of the suggested configurations to prolong...
General Discussion
Symbolic Link not working
Hello, I recently got a small sdd for my system. However, being a heavy gamer, my appdata folder is starting to get quite large and I do not want to "waste" all the writes on my sdd. I used this guide to move my entire user file over....
General Discussion
Directory junction/symbolic link not working
Recently I had to re-install Windows, but beforehand I had setup a directory junction for my Google Chrome installation. I did this because my boot drive is an SSD and I wanted to limit some of the writes to it because of cookies, etc. So I setup a directory junction from my C drive (ssd) to my...
General Discussion
Symbolic link across drives?
I am new to Windows 7 and new to using symlinks. Please bear with me. I am trying to make a hard link to a file on a RAM disk, but I get the error "The system cannot move the file to a different disk drive." I can't make a directory link to the RAM disk because I cannot fit all the files...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:19.
Twitter Facebook Google+