Feel free to change the directory name.
Output for sw post #9
C:\TEMP>dir
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3
Directory of C:\TEMP
03/21/2010 11:21 AM <DIR> .
03/21/2010 11:21 AM <DIR> ..
03/21/2010 11:19 AM 8 another file with spaces.txt
03/21/2010 11:18 AM 8 file with spaces.txt
03/21/2010 11:20 AM 8 File 2 test .txt
03/21/2010 11:20 AM 8 File 3 test .txt
03/21/2010 11:21 AM 8 good name.txt
03/21/2010 11:19 AM 8 Remove space from file name.txt
6 File(s) 48 bytes
2 Dir(s) 297,718,951,936 bytes free
C:\TEMP>cd ..
C:\>
type swspaces.bat
@echo off
pushd %cd%
cd /d c:\temp
setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('dir /a-d /b') do (
set inFile=%%a
set newName=!inFile: =!
copy "%%a" !newName!
)
popd
Output:C:\>swspaces.bat
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
C:\TEMP>dir
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3
Directory of C:\TEMP
03/21/2010 11:27 AM <DIR> .
03/21/2010 11:27 AM <DIR> ..
03/21/2010 11:19 AM 8 another file with spaces.txt
03/21/2010 11:19 AM 8 anotherfilewithspaces.txt
03/21/2010 11:18 AM 8 file with spaces.txt
03/21/2010 11:20 AM 8 File 2 test .txt
03/21/2010 11:20 AM 8 File 3 test .txt
03/21/2010 11:20 AM 8 File2test.txt
03/21/2010 11:20 AM 8 File3test.txt
03/21/2010 11:18 AM 8 filewithspaces.txt
03/21/2010 11:21 AM 8 good name.txt
03/21/2010 11:21 AM 8 goodname.txt
03/21/2010 11:19 AM 8 Remove space from file name.txt
03/21/2010 11:19 AM 8 Removespacefromfilename.txt
12 File(s) 96 bytes
2 Dir(s) 297,718,951,936 bytes free
C:\TEMP>