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?

有帮助吗?

解决方案

find -type l -print0|xargs -0 ls -ld|grep Dropbox
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top