Computing.Net > Forums > Windows XP > Rename files with specific extension pattern

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 with specific extension pattern

Reply to Message Icon

Name: fengineer
Date: August 17, 2009 at 20:16:43 Pacific
OS: Windows XP
Subcategory: General
Tags: DOS, batch, command, rename, pattern
Comment:

I’ve searched the forums on this site & couldn’t find anything conclusive. I need a DOS batch command similar to the one below to add a '.tif' extension to multiple files that have a specific pattern in their extension.

The DOS batch command line:
for %%i in (*.????????) do ren %%i %%i.tif

For example, rename *.20080902 to *.20080902.tif in the same directory as the batch file.

The only problem is that the above script renames all files in the directory (including the batch file 'ren2tif.bat').

The script needs to SKIP files that DO NOT have the 8-digit numeric format (i.e., *.yyyymmdd) in the extension.

Any ideas?



Sponsored Link
Ads by Google

Response Number 1
Name: Wahine
Date: August 18, 2009 at 00:44:32 Pacific
Reply:

Try using a bit more detail in the extension e.g. *.2008????


0

Response Number 2
Name: fengineer
Date: August 18, 2009 at 17:04:40 Pacific
Reply:

Thanks,

That worked. The solution looks so obvious now.

I changed the the batch file as follows:
for %%i in (*.20??????) do ren %%i %%i.tif

This will rename any file produced this century. These are simply TIF images that get churned out by a CAD program & uploaded to a unix server. I needed this script to work for Windows so we can review/print drawings before uploading them to our unix server. Some projects may over a hundred drawings so renaming them one by one is not practical!

To rename them back I just use:
ren *.20*.tif *.


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 Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Rename files with specific extension pattern

Can't delete file with no extension www.computing.net/answers/windows-xp/cant-delete-file-with-no-extension/72331.html

rename file with folder name www.computing.net/answers/windows-xp/rename-file-with-folder-name/114886.html

Folders became files w/o extension! www.computing.net/answers/windows-xp/folders-became-files-wo-extension/63747.html