CMD, DOS

Replacing file extensions from uppercase to lowercase

Here’s a very simple utility that recursively finds uppercase file extensions and makes those who are lowercase. For once, it’s not written in C# but in good old DOS.

If you paste this code in a CMD file, you’ll have a working program. If you execute this cmd, it will take the current folder as the root and it will process all files and subfolders.


for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")
for /r /d %%x in (*) do (
    pushd "%%x"
    for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")
    popd
)

Nowadays you would use PowerShell but this is a way to provide a quick fix to your users.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s