Вопрос

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