-   Linux - General (
-   -   spaces in filenames (

ebone 11-12-2001 01:27 AM

spaces in filenames
what can i do to get rid of (or replace with an underscore) the spaces in filesnames copied from from my windows box to a linux box



unSpawn 11-12-2001 11:51 AM


if [ ! -d "$1" ]; then
echo $1 must be dir
exit 1
else cd "$1"
for f in $(/bin/ls * | grep " "); do
nwName=$(echo "$f" | sed -e "s/ /_/g")
mv "$f" "$nwName"
cd $cdir

Im running Bash on Linux and Windows, so this should work crossplatform, just check before deploying it, and use quotes or backslashes when entering wintendo dirnames with spaces.
It's a kinda crude solution, but it works for me.

Save this as something like "" and invoke with the path+dirname as the single argument, changes every filename with spaces in that dir to filenames with underscores.

HTH somehow.

ebone 11-12-2001 11:56 AM

thanks, i'll give it a try


All times are GMT -5. The time now is 02:25 AM.