Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Changing File Names Using DOS

Reply  
Thread Tools
Dustin Cook's Avatar
Member with 74 posts.
 
Join Date: Dec 2003
Location: Ireland
Experience: Intermediate
02-Sep-2009, 12:49 PM #1
Changing File Names Using DOS
Hi.

I have a load of files which all begin with:

N341_00702202....

But I want to change them all to be

N341_200702202....

Does anyone know how to achieve this using dos?

Cheers,
DC.
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
02-Sep-2009, 02:05 PM #2
I would just use a file rename utility. There are plenty of them out there. Yes it can be done natively with a dos batch file but why write one for a one shot deal. As long as you just want the character after the underscore changed to a 2 on all files it would be easy enough to do with a batch file.

I use a program called V-The File Viewer to accomplish this task though. Would take me all of 5 seconds.
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
02-Sep-2009, 02:16 PM #3
I think this should work. Just whipped it out real quick.
Code:
@echo off
TITLE Re-name Filenames

:: Set _iFolder to the folder name with all your files.  Don't put your batch file here.
set _iFolder=C:\pathtofiles

pushd "%_iFolder%"

:: change to the appropriate file extension or just put in an asterisk
FOR /F "tokens=1* Delims=_" %%A IN ('dir /b /a-d N341_00702202*.txt') DO (
	rename "%%A"_"%%B"  "%%A"_2"%%B"
	)
popd
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:38 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.