Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Apps and Programs
script
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="cazabam" data-source="post: 232737" data-attributes="member: 17895"><p>There's no reason you can't have multiple consecutive spaces in filenames in linux. You just have to remember to put quotes round the filename or escape each space individually.</p><p></p><p>However, to do what you want, try this (it should work under Linux, and quite possibly under Mac OS X too, as long as you are using bash)</p><p></p><p>[CODE]for f in *</p><p> do</p><p> n=${f// */ /} # <-- note that this is f//{space}{space}*/{space}/</p><p> mv "$f" "$n"</p><p>done[/CODE]</p><p></p><p>Run this in the directory containing the files and it will do the magic. The 'for f in *' line can be changed to match just the files (e.g. for f in *.txt).</p></blockquote><p></p>
[QUOTE="cazabam, post: 232737, member: 17895"] There's no reason you can't have multiple consecutive spaces in filenames in linux. You just have to remember to put quotes round the filename or escape each space individually. However, to do what you want, try this (it should work under Linux, and quite possibly under Mac OS X too, as long as you are using bash) [CODE]for f in * do n=${f// */ /} # <-- note that this is f//{space}{space}*/{space}/ mv "$f" "$n" done[/CODE] Run this in the directory containing the files and it will do the magic. The 'for f in *' line can be changed to match just the files (e.g. for f in *.txt). [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Apps and Programs
script
Top