Davno
08-14-2007, 07:02 PM
Hi, Is there a script to remove empty space in a file name? I have a few thousand files named properly but they have empty space in there names that i want to removed. To do the job manually would take forever. :)
|
Click to See Complete Forum and Search --> : script to remove empty space in files name ? Davno 08-14-2007, 07:02 PM Hi, Is there a script to remove empty space in a file name? I have a few thousand files named properly but they have empty space in there names that i want to removed. To do the job manually would take forever. :) retsaw 08-14-2007, 07:57 PM If you want to remove all spaces in the filenames this should do the trickIFS=$'\n';for i in `find /path/to/files -type f`;do dir=`dirname $i`;name=`basename $i|sed "s/ //g"`;mv $i $dir/$name;done;unset IFSObviously, change /path/to/files to where the files you want renamed are located. If you want underscores instead of spaces, change the sed command to sed "s/ /_/g" Davno 08-14-2007, 08:25 PM Amazing thxs, It worked like a charm. :rolleyes::eek::):D saikee 08-15-2007, 01:36 PM Another example showing users sticking with GUI are missing at least 50% of what Linux can do. justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |