Converting spaces in filenames to underscores
Linux supports long file names, in some (many?) ways better than windows. However, when I moved over to linux I had tons of files with spaces in the name. This isn’t really a problem usually, but it can be a bit annoying having to enclose the filename in quotes for everything… anyway. Most of these were mp3′s that I had ripped from my collection of cd’s to store on the server. The script I used to automatically play through the music archive had problems dealing with the spaces (and I didn’t want to figure out how to make it work…) so I found another solution….
I found a bash script that basically does the job. It’s very simple and I can’t take credit for writing it, but if you want to convert spaces in filenames to underscores then this is for you…..
#!/bin/bash
for i in $(ls -1 *)
do
rename _ *.$1
done
Basically, it takes the file extension of the files you want to rename as an argument, so to rename files with spaces that are mp3s…. call it like this
$convertspaces mp3
and everything in the current directory get’s “fixed”.
Popularity: 1% [?]
Related Posts - chkconfig for ubuntu or other debian based linux systems As I've mentioned I've got an ubuntu based test system. Most of my linux experience has been from a red-hat derivitive-based background and for that, at the command line, you have chkconfig which is a good tool for checking the configuration of services to run at startup. It is a......
- How to Recover deleted items from Outlook .pst file About 6 months ago I had a customer call with a bit of a crisis. They had deleted some folders in Outlook without realizing the cleared out a few things they NEEDED to keep. Up until then I hadn't had much opportunity to try to find out what was recoverable,......
- Drive images - filling free space with zeros So, one of the things I've been doing is drive imaging. I've got 3 systems that are to be identical (based on, of all things Freedos...) So, I thought it was a perfect opportunity to dust off cloning/imaging software. So, I've been using the excellent g4l (ghost4linux) which is now......
Related Websites - How do RSS Feeds Work? If you’re confounded by that little orange graphic you see on blogs, it’s time to learn all about RSS and how it can benefit your own blog. Most software packages and content management systems offer RSS capablility, but it’s up to you to implement it. When used properly, RSS feeds......
- Learning Basic Money Management Skills Whether economics is your idea of a great way to fight insomnia, or you just didn’t get the benefit of learning about money management early on, it is never to late to learn the basic skills of proper money management. We highly recommend taking a brief course on finance if......
- File Sharing For All People People from all over the world can share files with the others. The World Wide Web offers the significant number of opportunities to benefit from and file sharing is only one of them. It is great to spend some time surfing and looking through the information you need or just......
Similar Posts
- Automatically downloading a file mp3 with a bash script
- Converting MPG video to dv files
- Cutting Short, splitting or truncating mp3 files…
- Converting pdf to tif (tiff) images
- Quick way to make a text only banner image