1.

Solve : removing periods from directory names?

Answer»

Well I'm just stumped. I've written plenty of batch files, but can't for the life of me figure this one out.

I have a directory named report.2004.09.09 and I need to create a batch file to remove the periods from the directory name. A NEW directory is created everyday with periods. Can anyone help me figure this out?

Thanks,
CharlieI'm running Windows98se and in a DOS window I enter the command
REN report.2004.09.09 abcdef
and the file name was changed to abcdef

or am I MISSING SOMETHING in your query?

Chris CHeres a way of solving your problem

first, pass the name of the directory to a blank text file i will call "test.txt" which has one line "report.2004.09.09"

then create a bach file called "name.bat" and put this in there
"
FOR /F "tokens=1-10 delims=." %%J IN (%1) DO SET MMDD=%%J%%K%%L%%M
SET correctdate=%MMDD%
echo %correctdate%
"
the echo is just there for you to CONFIRM that it works. instead of ECHOING it, you can just rename the direcotry with the new output



Discussion

No Comment Found