bug-findutils
[Top][All Lists]
Advanced

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

find - quoting spaces in filenames


From: Mike Depot
Subject: find - quoting spaces in filenames
Date: Tue, 11 Jun 2002 17:04:24 -0400

I tried to do this in a home directory:
chmod 775 `find .-type d`
and realized that because of a Win4Lin install there happened to be a lot of
filenames with spaces in them. ( "Program Files", "My Documents", etc.).  Of
course chmod interpreted the spaces in the filenames as parameter
delimiters...

I quickly changed over to this instead:
find . -type d -exec chmod 775 {} \;
which worked fine, but it got me thinking that it might be nice to have an
option that would output quoted versions of filenames to handle other
situations where the filenames contain spaces, (which might get more common
with Win4Lin available.)  If the idea of a quoting option for -print is out,
perhaps consider an escaped quote character ( \" ) for -printf.  Then things
like this would be possible:
chmod 775 `find .-type d -printf "\"%p\""`

Thanks

P.S. Please forgive if I'm way off due to ignorance here.  I tried to
research this first, but the word 'find' is so prolific, the search engines
turned up many false hits...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]