Pages

Saturday, July 2, 2011

Batch File - Bulk Renamer ... Advanced

This post is the continuation of my last post, i.e., Batch File - Bulk Renamer; related to systematically renaming all the files in a folder.

The problem I noticed with my previous code is that, either it works with the particular type of file (aka same extension) or in absence of file-extensions it renames this batch file also. So I thought to introduce a condition in this so as to skip this batch file while renaming other files.

Here is the code for that,

.:C.O.D.E:.

@echo off&set /a cnt=1
for %%a in (*) do call :PROCESS "%%a"
goto :EOF
:PROCESS
IF not %1=="bulk_renamer.bat" (rename %1 "IMG_%cnt%.jpg")
set /a cnt+=1


Note: This code would rename all the files present in the folder except bulk_renamer.bat

Help: Refer to my previous post for the steps to create or modify the script.

Link: http://akzcool.blogspot.com/2010/11/batch-file-bulk-renamer.html

No comments:

Post a Comment