[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: whitespace in filenames
From: |
Rinehart, Raleigh |
Subject: |
RE: whitespace in filenames |
Date: |
Wed, 24 Sep 2008 16:46:34 -0500 |
> >
> > > I've got these rules to transcode my .flac music files to .mp3:
> > >
> > > FLACS := $(shell find ./flac -name "*.flac" -print)
> > >
> > > MP3 := $(patsubst ./flac/%.flac,./mp3/%.mp3,$(FLACS))
> >
> > Why do you even need these two lines? They seem extraneous, as you
> > never use the resulting variables.
>
> Actually this line was missing from my post:
>
> all: $(MP3)
>
> So I only have to type 'make' to encode/update my .flac collection.
>
> > The problem is that all of the built-in make functions treat variables
> > containing lists of items as "words separated by spaces" and there is no
> > way to change that with quoting. So if you want to use built-in
> > functions like patsubst and so on that act on variables containing lists
> > of things, prepare for it to not work when an item in the list contains
> > spaces.
> >
> > If you avoid the built-in functions then you might be able to get by
> > with just proper shell quoting alone.
>
> OK, this makes sense now. Is the culprit 'shell' or 'patsubst' or both?
>
> Thanks for your clear explanation,
>
>
The problem is $(patsubst ) and this will be true for any Make function.
To quote Paul Smith:
> You cannot, in general, use GNU make (or any other standard make) with
> pathnames containing spaces. It just won't work. Pathnames in
> makefiles are really parsed as text strings, and virtually every
> function and internal processing splits the strings on whitespace.
> Further, there is no 100% recognized and reliable way to quote
> whitespace in these strings.
What is true for pathnames is also true for filenames.
The only reasonable way I can think of is to either rename all your files to
not have spaces or use sentinel files (which would be ugly, messy and just
painful).
You can do a mass rename with something like this in a bash shell (untested)
find . -name *.flac | while read f; do mv "$f" `echo "$f" | sed 's/ /-/g'`;
done
-raleigh
- Re: whitespace in filenames, (continued)
- Re: whitespace in filenames, Brian Dessent, 2008/09/24
- Re: whitespace in filenames, Stephan Beal, 2008/09/24
- Re: whitespace in filenames, Louis-David Mitterrand, 2008/09/24
- Re: whitespace in filenames, Patrick Horgan, 2008/09/25
- Re: whitespace in filenames, Brian Dessent, 2008/09/25
RE: whitespace in filenames,
Rinehart, Raleigh <=
- Re: whitespace in filenames, Patrick Horgan, 2008/09/25
- Re: whitespace in filenames, Ted Zlatanov, 2008/09/25
- Re: whitespace in filenames, Patrick Horgan, 2008/09/25
- RE: whitespace in filenames, Dave Korn, 2008/09/25
- Re: whitespace in filenames, Patrick Horgan, 2008/09/25
Re: whitespace in filenames, Louis-David Mitterrand, 2008/09/25
Make with zsh (was: whitespace in filenames), Ted Zlatanov, 2008/09/26
Re: Make with zsh (was: whitespace in filenames), Paul Smith, 2008/09/26
Re: Make with zsh (was: whitespace in filenames), David Boyce, 2008/09/26
Re: Make with zsh (was: whitespace in filenames), Martin d Anjou, 2008/09/26