问题
I need to remove a large number of symbolic links from a folder that has other files which I don't want to remove. Is there any easy way to remove only symbolic links?
回答1:
You can use the find(1) command
find . -maxdepth 1 -type l -exec rm {} \;
-maxdepth 1is for only scanning current directory.-type lis for searching symbolic links-execexecutesrmto delete given file, the{}being replaced byfindwith an appropriate path, and the\;ending the sub-command run byfind
See also the man page of rm(1) (and of ls(1), mv(1), cp(1), ln(1), stat(1) if you want to use them in a variant of that find command).
来源:https://stackoverflow.com/questions/53978194/remove-symbolic-links-only-from-a-folder-in-tcsh