rename files and folder to lowercase with b

May 25, 2009 at 03:45:56
Specs: Windows XP, 3.4
rename files and folder to lowercase with batch codes
================================================
hi guys
i searched this site and found a batch code for rename all files in current folder and subfolders from upercase to lowercase
its working and its perfect all i need to add to this batch code is here=
this program just search for files and rename them but i need to add folders too
i want not only files in current folder and subfolders but also folders themselves and their subfolders get renamed from upercase to lowercase
is there a way? can you fix my batch code? or if not can you give me a new one?
thanks
codes are below

@echo off
if .%1==./? (
echo Changes all filenames in the given dir to lowercase
echo.
echo %~n0 dir [/s]
echo.
echo dir The directory.
echo /s Include subdirectories of 'dir'.
goto :EOF)
setlocal
pushd %1
if .%2==. (
set DIRCMD=/L/B
echo Rename all filenames in %1 to lowercase filenames?&goto :Anykey
) else if /i .%1==./S (
set DIRCMD=/L/B/S/A-D
echo Rename all filenames in %1 and its subdirs to lowercase filenames?&goto :Anykey
) else (
echo Invalid switch: %*&goto :End)
:Anykey ---------------------------------------------------------------
for /f "tokens=*" %%F in ('dir/s') do move "%%F" "%%F"
:End ------------------------------------------------------------------
popd&endlocal&goto :EOF


See More: rename files and folder to lowercase with b

Report •


#1
May 25, 2009 at 05:41:12
Now I'm sure I need some new drugs.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
May 25, 2009 at 06:32:23
what?
cant you solve it dear Mechanix2Go?
its seems to be easy for you
just add folder for check
thats it
codes above just rename files i need folder too
thanks

Report •

#3
May 25, 2009 at 08:11:58
simple requirement and above script without indention makes it hard to read, and some variable isn't utilized throughout the script after lots of if-else checking, eg. DIRCMD

@echo off & setlocal enabledelayedexpansion

for /f "tokens=*" %%a in ('dir/b/s/l') do (
	set f=%%a
	set f=!f:%%~dpa=!
	ren "%%a" "!f!"
)


Report •

Related Solutions

#4
May 25, 2009 at 11:34:08
thanks dear reno
simple and nice
its working perfect god bless you
i hope you be healthy in your entire life
please if you can and have time help me with my another question in here
http://www.computing.net/answers/pr...

Report •


Ask Question