Re: Bash script for files with spaces in the filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, Feb 16th 2006 at 19:54 +0800, quoth John Summerfied:

=>Tim Fenn wrote:
=>> On Thu, Feb 16, 2006 at 11:29:04AM +0200, Dotan Cohen wrote:
=>> 
=>> > Another friend has provided me with a simple bash script that performs
=>> > an operation on all the files of a directory. However, many of the
=>> > file names contain spaces. How can I modify the following code to work
=>> > on files with spaces? The directory is on a mounted FAT32 partition.
=>> > 
=>> 
=>> 
=>> xargs, yo!
=>> 
=>> find $(pwd) -name "*.mp3" -print0 | xargs -0 eyeD3 --force-update
=>> --set-encoding=utf8
=>
=>man xargs for the scoop, sometimes you want to run your eyeD3 with just one
=>filename.
=>
=>This works too:
=>find . -type f -name "*.mp3" \
=>   -exec eyeD3 --force-update --set-encoding=utf8 {} \;
=>
=>man find for more.
=>
=>Note that the original script will also fail if the length of the commandline
=>generated is too great. Just for laughs:
=>echo $(find / -type f) 2>/dev/null

or just say

find | xargs -n 1

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux