LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-02-2006, 04:18 AM   #1
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 612

Rep: Reputation: 32
Getting rid of Blackspaces in filenames


Hy!

Users go on saving files with "." and " " in the names.

like:

./op/Fu\uffffball 31.08.02 003.jpg

I would like to use a script renaming all files in a subfolder and substiture all "." and " " with "_".

I used

find . -name '*\ *' -print | sed -e "s/\ /_/"

but that only gives me:

./op/Fu\uffffball_31.08.02 003.jpg

but there is an other " " which is not substitued!

Ideas ?
 
Old 10-02-2006, 04:26 AM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 612

Original Poster
Rep: Reputation: 32
find . -type f -print | while read f; do
n="`dirname \"$f\"`/`basename \"$f\" | sed 's/ /_/g'`"
echo $n
done
~

works!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
* after filenames neocontrol Linux - General 11 07-24-2006 10:00 AM
How get rid of funny characters in filenames? Bengan Mandriva 11 01-07-2006 12:38 PM
Filenames eponymous Linux - Software 3 05-25-2005 07:36 AM
locate filenames only allelopath Linux - Software 1 02-04-2005 03:39 PM
Getting rid of "\" before spaces in filenames when using the ls command Locura Linux - Distributions 8 07-05-2003 11:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration