Need help listing symbolic links
On a Unix/Linux system I need to run the "find" command on a set of directories to find what all the symbolic links within those directories are. I need to get a list 开发者_Go百科of the symbolic link paths in one file AND a list of the output of "ls -l" on those symbolic links in another file. How can I do this?
Change to the directory in question, then:
$ find -type l > /tmp/link_names.txt
$ (for link in $(cat /tmp/output.txt); do ls -l "$link"; done) > /tmp/link_details.txt
Warning: if any of the paths contain spaces you'll have to use something like this to get the "ls -l" output:
$ find -type l | -print0 | xargs -0 ls -l > /tmp/link_details.txt
精彩评论