Blog

Script to identify working symlinks in a folder

Tags: findscriptsoftlink

Published on: September 12, 2014 by Arnold Pablo

Script to identify working symlinks in a folder

Scenario:

There could be situations where you see lots of dead symbolic links inside a folder. As in the example below there are 15828 symbolic (soft links) but there are only 188 files which are working symblolic links while all others are dead. So we need a way to identify working symlinks in a folder.

# ls -lst | wc -l
15828
Command to identify working symlinks inside a folder is to execute the below command.
find /dir/to/check -type l ! -xtype l
Warning
While googling, you may find options to use find . -L -type l .. DON’T USE THIS. It may cause unexpected results.
Get 24/7 expert server management

Category : Howtos, Linux, Troubleshooting

Arnold Pablo

Arnold Pablo

Technology always fascinated me and continues to do so. I started my career back in 2004 as a Junior System Admin and worked in various capacities both in technical and managerial roles. I love to experiment and try out new OSS projects and in free time, go for cycling to the interiors of God's own country, Kerala!

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items