Using FIND to globally rename files...
How do you use FIND to globally rename files?
I find that some music files that have '!' embedded in them to cause conflicts especially when attempting to use Nautilus to move them from one location into another, so I wish to rename files that have offending characters in them. I tried: 1) find . -type f -name *.mp3 -exec mv "{}" `echo "{}" | sed -e 's/[!]//`" ; Nope. Does not work. 2) find . -type f -name *.mp3 | xargs "echo "mv "{}" `echo "{}" | sed -e 's/!//`"" Ah, this is really convoluted, of course it does not work. It is rife with errors indeed! :) Um, help!?!? Kind regards, Dan -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
Daniel B. Thurman wrote:
How do you use FIND to globally rename files? I find that some music files that have '!' embedded in them to cause conflicts especially when attempting to use Nautilus to move them from one location into another, so I wish to rename files that have offending characters in them. I tried: 1) find . -type f -name *.mp3 -exec mv "{}" `echo "{}" | sed -e 's/[!]//`" ; Nope. Does not work. 2) find . -type f -name *.mp3 | xargs "echo "mv "{}" `echo "{}" | sed -e 's/!//`"" Ah, this is really convoluted, of course it does not work. It is rife with errors indeed! :) Um, help!?!? Kind regards, Dan Nope! You get to execute one and only one command in a find statement but that can be a shell script. You might try putting your pipe into a script and then executing the script with the find. John Cornelius -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
Daniel B. Thurman wrote:
How do you use FIND to globally rename files? I find that some music files that have '!' embedded in them to cause conflicts especially when attempting to use Nautilus to move them from one location into another, so I wish to rename files that have offending characters in them. I tried: 1) find . -type f -name *.mp3 -exec mv "{}" `echo "{}" | sed -e 's/[!]//`" ; Nope. Does not work. 2) find . -type f -name *.mp3 | xargs "echo "mv "{}" `echo "{}" | sed -e 's/!//`"" Ah, this is really convoluted, of course it does not work. It is rife with errors indeed! :) Yes, the second has serious problems with nesting of quotes. Simplest way is to use the 'rename' command: find . -type f -name '*!*.mp3' -exec rename '!' ' {} ; -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it. -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
On Fri, 2008-06-20 at 12:06 -0500, Robert Nichols wrote:
> Daniel B. Thurman wrote: > > > > How do you use FIND to globally rename files? > > > > I find that some music files that have '!' embedded in them > > to cause conflicts especially when attempting to use > > Nautilus to move them from one location into another, > > so I wish to rename files that have offending characters > > in them. > > > > I tried: > > > > 1) find . -type f -name *.mp3 -exec mv "{}" `echo "{}" | sed -e > > 's/[!]//`" ; > > Nope. Does not work. > > > > 2) find . -type f -name *.mp3 | xargs "echo "mv "{}" `echo "{}" | > > sed -e 's/!//`"" > > Ah, this is really convoluted, of course it does not work. It is rife > > with errors indeed! > > :) > > Yes, the second has serious problems with nesting of quotes. Simplest > way is to use the 'rename' command: > > find . -type f -name '*!*.mp3' -exec rename '!' ' {} ; Slightly better: find . -type f -name '*!*.mp3' -print0 |xargs -0 rename '!' ' This will work even for filenames with spaces in them (quite common with music files). poc -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
Patrick O'Callaghan wrote:
On Fri, 2008-06-20 at 12:06 -0500, Robert Nichols wrote: Simplest way is to use the 'rename' command: find . -type f -name '*!*.mp3' -exec rename '!' ' {} ; Slightly better: find . -type f -name '*!*.mp3' -print0 |xargs -0 rename '!' ' This will work even for filenames with spaces in them (quite common with music files). As will the command I suggested. Arguments to commands invoked by "-exec" are passed WITHOUT being parsed by a shell. -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it. -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
On Fri, 2008-06-20 at 16:35 -0500, Robert Nichols wrote:
> Patrick O'Callaghan wrote: > > On Fri, 2008-06-20 at 12:06 -0500, Robert Nichols wrote: > >> Simplest > >> way is to use the 'rename' command: > >> > >> find . -type f -name '*!*.mp3' -exec rename '!' ' {} ; > > > > Slightly better: > > > > find . -type f -name '*!*.mp3' -print0 |xargs -0 rename '!' ' > > > > This will work even for filenames with spaces in them (quite common with > > music files). > > As will the command I suggested. Arguments to commands invoked by > "-exec" are passed WITHOUT being parsed by a shell. Fair enough. poc -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
Using FIND to globally rename files...
Daniel B. Thurman wrote:
How do you use FIND to globally rename files? I find that some music files that have '!' embedded in them to cause conflicts especially when attempting to use Nautilus to move them from one location into another, so I wish to rename files that have offending characters in them. I tried: 1) find . -type f -name *.mp3 -exec mv "{}" `echo "{}" | sed -e 's/[!]//`" ; Nope. Does not work. 2) find . -type f -name *.mp3 | xargs "echo "mv "{}" `echo "{}" | sed -e 's/!//`"" Ah, this is really convoluted, of course it does not work. It is rife with errors indeed! :) Um, help!?!? Kind regards, Dan You might want to check this program. I use it all the time ... http://sourceforge.net/projects/detox Regards, John -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list |
| All times are GMT. The time now is 09:20 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.