Computing.Net > Forums > Programming > rename files and folder to lowercase with b

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

rename files and folder to lowercase with b

Reply to Message Icon

Name: niki chan
Date: May 25, 2009 at 03:45:56 Pacific
OS: Windows XP
CPU/Ram: 3.4
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 25, 2009 at 05:41:12 Pacific
Reply:

Now I'm sure I need some new drugs.


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

M2


0

Response Number 2
Name: niki chan
Date: May 25, 2009 at 06:32:23 Pacific
Reply:

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


0

Response Number 3
Name: reno
Date: May 25, 2009 at 08:11:58 Pacific
Reply:

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


0

Response Number 4
Name: niki chan
Date: May 25, 2009 at 11:34:08 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: rename files and folder to lowercase with b

hiding picture files and folders www.computing.net/answers/programming/hiding-picture-files-and-folders/3886.html

Enumerate all files and folders www.computing.net/answers/programming/enumerate-all-files-and-folders/9618.html

Bacth file to rename the DRM folder www.computing.net/answers/programming/bacth-file-to-rename-the-drm-folder/16823.html