How to mass remove symbolic links in Windows (among regular files that share similar name in many folders)

command linefile-filterfile-typessymbolic-link

Is there any way to quickly remove many symbolic links in many folders that contains many other files? E.g some command in command prompt (be able to delete all slink created from day XX for example)?

Remove all objects that are symbolic link, all other objects remain. Now I only navigate folder by folder, manually selecting them in Windows Explorer (rearrange all items by size, and symbolic links size 0KB, and shift key select all –> del) and remove slowly, maybe sometime mistake sl with another 0KB files. My younger bro drag & drop a lot of files with right click (Link Shell Extension Copyright (C) 1999 – 2008 by Hermann Schinagl already installed in PC, integrated into Windows Explorer) and he pick drop as symbolic link, it all became garbage.

Best Answer

This is similar to JdeBP's answer, but it doesn't require any external software:

FOR /F "usebackq delims=" %a IN (`DIR /a:l /s /b "C:\dir\with\symlinks"`) DO RMDIR "%a"

When used in a script, substitute %a with %%a.

Related Question