Results 1 to 6 of 6
I have a large tree. It is mostly links but has a bunch of files too. I want to recursively remove ONLY the links. Is there a way?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-31-2011 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 8
remove symbolic links only
I have a large tree. It is mostly links but has a bunch of files too. I want to recursively remove ONLY the links. Is there a way?
- 08-31-2011 #2
- 08-31-2011 #3Just Joined!
- Join Date
- Dec 2009
- Posts
- 8
I think that would work but I don't know how to pass the output of find to unlink. I tried "find -type l | unlink" but that complained.
- 09-02-2011 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,664
Use the 'exec' function of find, e.g.:
Not sure what diff b/t unlink and rm is, but rm will remove your links, too.Code:find . -type l -exec rm -vi {} \;
- 09-02-2011 #5Just Joined!
- Join Date
- Dec 2009
- Posts
- 8
That did it, thanks.
- 09-02-2011 #6
for current folder and tree I'd try something like unlink $(find -type l) ... anyway glad you got it sorted


Reply With Quote
