I hate spaces
I never used to care how files were named until I started using mostly terminal at work. Now I cannot stand it if a file name has any spaces or upper case characters don't bug me as much but those spaces are going to drive me nuts. If its not to hard I might make a script to remove spaces from file names and make an alias for it so I can do it with ease.
Have a look at detox
A bit old. But still available, at least via the standard repository of a fedora 17.
I hear and feel the hate for spaces in file names. It turns out that detox is also available in the Ubuntu repositories.
I hate spaces too and I am using detox for a long time. Works really well and save a lot time.
yes ,you should make a script to rename your file ,and it's seem not difficult,but if you want to make a script auto rename each time ,it may be a little difficult, you can usd find . -name “*” get all your filename ,or "* *"pattern to match a file with at least one space , then there are sever ways to resolve this problem, you can choose one you like,
1.use vi to make a list of command ,copy your find command output to vi,then use command :%s///g make the string "x1 x2" to "mv x1\ x2 x1x2" copy the list of the command to shell to execute or save as a script a.sh , go out of vi ,bash a.sh
2.use shell script,
3. use c language ，C can do anything you want ,but a little difficulter than shell scripter
yeah, put me in the "hate names with spaces" camp. i've never heard of detox before, will be checking it out.
here's a couple of things i've learned, which help me nowadays.
1) when ditting around in the terminal, use a "\" character before the space in a file name (to "escape" it), then hit the [Tab] key, and bash will attempt to auto-complete the filename for you.
2) when writing scripts to deal with filenames with spaces, you'll hear about changing the IFS (Input Field Separator) bash built-in variable. don't bother with that, just use command substitution in a loop. here's an example:
# script to find files in the CWD and rename them, replacing spaces w/underscores
while read file; do
new=$(echo $file|sed -e 's| |_|g')
mv -vi "$file" $new
done < <(find . -mindepth 1 -maxdepth 1 -type f -name '* *')
Never heard of detox. I have to say I love this tool and it works great.
Also available from the Sabayon repos too.
I installed detox at home and love it. I am unable to install at work so I wrote this script and it works great for replacing spaces with underscores and making every letter lower case.
It works great on a AIX system. I tried to use rename but it is not installed.
ls | while read -r FILE
mv "$FILE" `echo $FILE | tr ' ' '_' | tr '[A-Z]' '[a-z]' `