I have a large batch file that searches %CD% and sub-directory's and ether moves, copies or deletes files of my choosing. I have ran into a problem where the .bat file will pass over files of any type if they have certain symbols in their name like (!,-). Is their a way to have a batch file search %CD% and sub-directory's for files that contain these symbols and rename them with their current name without the symbols? For argument sake lets just use the (!) symbol, and I can edit in the rest. Thank you in advance.
EDIT--------------------------------------------------- Here is part of my code I am using. I do not have one for what I am trying to accomplish at the moment.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set /p folder1=Folder Name:
set TESTFOLDER=%folder1%
set /p Type=Enter File Type:
set /p copymove=Copy or Move:
set /p directory=DIR:
md "%TESTFOLDER%"
set /a counter=0
FOR /F "tokens=*" %%i IN ('DIR /S /B /A-D "%directory%\""*.%Type%"') DO FOR /F "tokens=*" %%j IN ('DIR /B "%%i"') DO IF EXIST ".\%TESTFOLDER%\%%j" (
set /a counter=!counter!+1
echo folder: %TESTFOLDER%
%copymove% "%%i" ".\%TESTFOLDER%\"%%j_!counter!.%Type%""
) ELSE %copymove% "%%i" ".\%TESTFOLDER%\%%j"
:eof