Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

Now I'm sure I need some new drugs.
=====================================
If at first you don't succeed, you're about average.M2

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

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!" )

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...

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |