Re: The rename command…
- From: "Johnny Rosenberg" <gurus.knugum@xxxxxxxxx>
- Date: Wed, 27 Aug 2008 00:00:33 +0200
2008/8/26 Johnny Rosenberg <gurus.knugum@xxxxxxxxx>
2008/8/26 Rashkae <ubuntu@xxxxxxxxxxxxxxx>When I was searching for a solution to my problem (which I now consider
Johnny Rosenberg wrote:That is just about the same as my first idea, (except that I had -name but
2008/8/26 Johnny Rosenberg <gurus.knugum@xxxxxxxxx>nätet:
2008/8/25 Ulf Rompe <Ulf.Rompe@xxxxxxxx>
Sorry all for the previous, empty post.lösning än den jag lyckades komma fram till via vild sökning på
On Mo, 2008-08-25 at 16:00 +0200, Johnny Rosenberg wrote:
Since there is a serious bug in Nautilus, that adds the veryI don't think it's a serious bug. I would call it bad design. :-)
unnecessary text "Link to " to a link created with Ctrl+Shift
+Drag&Drop,
rename -v 's/Link to //' *find . -type l -print0 | xargs -0 rename -v 's/Link to //'
However, there doesn't seem to be an option for recursivity built in
to that command. I am not good with scripts, but I am sure there is a
way around that.
[x] ulf
Tack så mycket! Har inte testat än, men det ser ut som en vettigare
bothfind . -name "Länk till "* -exec rename -v "s/Länk till //" {} \;
My guess is that your solution might be a bit faster. IN my solution,
thinkfind and rename look for the same thing, kind of…
As everyone can see, I'm a bash beginner but I learn all the time. I
tothat my new knowledge of xargs will make me able to do things that IOoops, sorry for the Swedish line there. For a strange reason I changed
couldn't before! Thanks again!
J.R.
English after that, I don't really know why… here's the translationfor the
first line anyway:I
Thanks! haven't tried it yet, but it makes more sense than the solution
came up with after some wild searching on the web:and
find… and so on.
By the way, after some more thinking, I combined your solution with mine
came up with the following:like.
find . -type l -exec rename -v "s/Länk till //" {} \;
This way it's all done without piping, at least that is what it looks
It would be interesting to hear from you (and others) about advantagesand
disadvantages with this line compared to other ideas. The only advantageI
can think of is that it's less to type, but I will make an alias for itfew
anyway, so that doesn't matter much, more than my alias file will be a
bytes smaller…ha
Anf I didn't try my last suggestion yet, maybe it doesn't work… ha ha
That should work.. I can't remember if I also had to esape the { }
characters in bash, or just the ;....
However, the command would be much more efficient if find was only
returning filenames that start with "Link To", they way your command
runs now, *every* file gets passed to rename. This would work, but is
wasteful, since rename then fires up perl and run a regexp that will
only fail.
find . -type l -name "Link to*" -exec rename -v "s/Länk till //" {} \;
not -type) after collecting as much info as possible from the web.
However, someone told me today that this will work (I write this one in
English since something on the way between me you guys doesn't use UTF-8, so
the Swedish characters gets "distorted" anyway):
find . -type l -exec rename -v "s/Link to //" {} +
The + seems to make find -exec work like find | xargs, sort of.
But to sum this up, I guess that the following would be a good combination
of all ideas so far:
find . -type l -name "Link to *" -exec rename -v "s/Link to //" {} +
On the other hand, I can probably assume that everything that can be found
that's not a link, does not start with "Link to " anyway, so in most cases
the type -l is very unnecessary…
In that case, that makes this the best solution, I'd guess:
find . -name "Link to *" -exec rename -v "s/Link to //" {} +
(same as your suggestion, but with "+" instead of "\;".
There also seems to be a -execdir option, but I didn't understand exactly
when or why I'd use it (I sometimes have some minor difficulties
understanding English in manuals etc).
J.R.
solved) I think I ran into a solution without the rename command… I think
they used mv instead, but I can't find it.
Is there a reason not to use rename (such as it might be slow or something,
maybe even incompatibility with non-Debian based systems)? I realise that I
need regular expressions to achieve the name change, which makes rename the
convenient choice, but there should be other ways, shouldn't it?
Unfortunately I never bookmarked the site where I found it (or THINK I found
it…).
J.R.
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- Follow-Ups:
- Re: The rename command…
- From: Rashkae
- Re: The rename command…
- From: Ulf Rompe
- Re: The rename command…
- References:
- The rename command…
- From: Johnny Rosenberg
- Re: The rename command…
- From: Ulf Rompe
- Re: The rename command…
- From: Johnny Rosenberg
- Re: The rename command…
- From: Johnny Rosenberg
- Re: The rename command…
- From: Rashkae
- Re: The rename command…
- From: Johnny Rosenberg
- The rename command…
- Prev by Date: Re: MD5SUM error in new Ubuntu
- Next by Date: Re: Can't pin down DVD no mount problem
- Previous by thread: Re: The rename command…
- Next by thread: Re: The rename command…
- Index(es):
Relevant Pages
|