Remove symbolic links only from a folder in tcsh [closed]

强颜欢笑 提交于 2019-12-25 18:37:13

问题


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 1 is for only scanning current directory.
  • -type l is for searching symbolic links
  • -exec executes rm to delete given file, the {} being replaced by find with an appropriate path, and the \; ending the sub-command run by find

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!