DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

Recursively listing symbolic links to a given folder with their full path

StackOverflow https://stackoverflow.com/questions/20301799
 Checked

Question

I would like to transverse my home folder and list all symbolic links which point to element having Dropbox in their path. The following command (plus some post processing to remove additional field of info, but that should not be difficult) nearly accomplishes the task

ls -alR ~ | grep -e "->" | grep Dropbox

In the output of my ls, the marker -> precedes the path to the target of the symbolic link. In order to only get symbolic links pointing to something in Dropbox I pass the output through the final grep. However there is a problem: this way I only get the name of the symbolic link and not its full path. On the other hand using a command like:

ls -alR ~ | grep -e "->" | grep -E '(Dropbox|:)'

to keep the path listing of ls (in recursive searches ls first outputs the folder being listed followed by a colon) results in far too many hits. Any ideas?

Solution

find -type l -print0|xargs -0 ls -ld|grep Dropbox
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow