Timeline for Batch Update Symbolic Links Recursively
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 20, 2020 at 2:02 | comment | added | fivedogit | As many people want to change /path/to/directory to /somewhere/else/completely (rather than just the last directory name), it would be much more robust for this solution to not use s/old/new notation as the slashes get in the way. I'm struggling to get this answer working for my use case. | |
Apr 13, 2020 at 23:59 | comment | added | Kyle Barbour | Worked great for me, thanks! In my case, there were only files, and only the target destination changed, which allowed for some simplification: $ find . -type l -lname '*regex*' -printf 'ln -sf "$(readlink "%p" | sed s/old/new/)" "%p"\n' > script.sh | |
Jul 19, 2017 at 20:20 | history | edited | David Z | CC BY-SA 3.0 |
fix code errors and integrate it into the surrounding text
|
S Jul 19, 2017 at 16:55 | history | suggested | 7yl4r | CC BY-SA 3.0 |
broke out variables to further improve legibility from generic standpoint
|
Jul 19, 2017 at 14:26 | review | Suggested edits | |||
S Jul 19, 2017 at 16:55 | |||||
Oct 22, 2014 at 4:47 | history | edited | David Z | CC BY-SA 3.0 |
fix quoting to allow using with filenames that include spaces
|
Oct 22, 2014 at 4:45 | comment | added | David Z | @Sparhawk oh, yeah, I see what you mean now. I missed that. I guess I may as well edit it in. | |
Oct 22, 2014 at 3:37 | comment | added | Sparhawk |
@DavidZ Sorry, my language was messed up. I mean that the entirety of the readlink…|sed… pipe should be contained in literal quotes, otherwise the command substitution will be split after the readlink pipe is executed. i.e. something like 'ln -nsf "$(re...
|
|
Oct 22, 2014 at 3:32 | comment | added | David Z |
@Sparhawk yes, the double quotes I suggested adding are precisely the same ones that would be literally written to script.sh .
|
|
Oct 22, 2014 at 3:15 | comment | added | Sparhawk |
@DavidZ I've since renamed them manually (like a n00b), but I suspect that one would also need literal quotes that are written to script.sh .
|
|
Oct 22, 2014 at 2:23 | comment | added | David Z |
@Sparhawk probably. To get around that you should use double quotes around both instances of %p .
|
|
Oct 22, 2014 at 0:18 | comment | added | Sparhawk | This fails for me, perhaps because I have spaces in paths? | |
Jun 30, 2010 at 3:54 | comment | added | David Z | Huh, weird. Well, if you ever figure out what was going wrong, put a comment here. I'm curious. | |
Jun 30, 2010 at 3:41 | vote | accept | ggutenberg | ||
Jun 30, 2010 at 3:41 | comment | added | ggutenberg | Actually, on further testing it looks like this is working. Not sure what I was doing wrong yesterday, but seems ok now. Thanks. | |
Jun 30, 2010 at 3:34 | comment | added | ggutenberg |
Yes, "find /home/user/public_html/qa/ -type l " outputs the links. But adding the -lname parameter it doesn't output anything.
|
|
Jun 29, 2010 at 5:34 | comment | added | David Z |
You did remember to change the paths to the actual ones on your filesystem, right? What happens if you run just find /home/usr/public_html/qa/ -type l ? If that doesn't find the links, something very weird is going on with your system.
|
|
Jun 29, 2010 at 4:25 | comment | added | ggutenberg |
This creates an empty script.sh. And running the find command as so: find /home/user/public_html/qa/ -type l -lname '/home/user/public_html/dev/*' doesn't output anything.
|
|
Jun 28, 2010 at 19:56 | history | answered | David Z | CC BY-SA 2.5 |