Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use divider files to organize albums in XMMS' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use divider files to organize albums in XMMS
Authored by: c15zyx on Mar 24, '04 04:51:38PM

One slight technicality... if you use a filename consisting of only spaces, if you quit and reopen XMMS, it will get a little confused because it tries to find "/somepathhere/ " where " " is the filename. Another solution is to append a "_" to the end of the spacer, which is displayed as a space in XMMS's playlist.



[ Reply to This | # ]
Use divider files to organize albums in XMMS
Authored by: pwharff on Mar 25, '04 02:54:11PM

If you want to replace a space or multiple spaces like in this case with underscores, you can run this shell script (maybe call it something like "rename"):

for file in * ; do
mv "$file" $(echo "$file" | sed 's/ /_/g')
done

Don't forget to make this executable with "chmod +x rename" or you can just run this on one line in the terminal where you spaced files reside:

for file in * ; do mv "$file" $(echo "$file" | sed 's/ /_/g') ; done

Both should work fine.



[ Reply to This | # ]
Also...
Authored by: pwharff on Mar 25, '04 03:00:36PM

I forgot to mention with the last script, that if other files in the same directory that do not have spaces in them will be ignored and untouched, however the script will return an error with the "mv" command. So that this is ignored, you could modify the script to send stnderr to /dev/null, that way no matter what, your script will run smoothly. Like such:

[code]
for file in * ; do
mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null
done
[/code]
or
[code]
for file in * ; do mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null ; done
[/code]



[ Reply to This | # ]
Fixed
Authored by: pwharff on Mar 25, '04 03:03:47PM
Why can't we edit our post after we've submitted? So here it is again posted twice and formatted correctly, but this time I'm not so much of an idiot. I forgot to mention with the last script, that if other files in the same directory that do not have spaces in them will be ignored and untouched, however the script will return an error with the "mv" command. So that this is ignored, you could modify the script to send stnderr to /dev/null, that way no matter what, your script will run smoothly. Like such:

for file in * ; do 
   mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null
done
or

for file in * ; do mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null ; done


[ Reply to This | # ]