Computing.Net > Forums > Programming > Batch File Renamer

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Batch File Renamer

Reply to Message Icon

Original Message
Name: tj007s13
Date: November 2, 2007 at 23:45:22 Pacific
Subject: Batch File Renamer
OS: XP pro
CPU/Ram: 2GB
Model/Manufacturer: Custom
Comment:

I need a batch file that renames a bunch of files for me. Basically each file name has 10 characters and a period(.) and then the rest of the name. The 10 characters is always the same.

For example:
mywebsite.file1.jpg
mywebsite.file2.jpg
mywebsite.file3.jpg

I just want it to be:
file1.jpg
file2.jpg
file3.jpg

So removing the first 10 characters of the file name or removing a certain phrase from the file name should work. I am a batch noob so any help I would greatly appreciate.


Report Offensive Message For Removal


Response Number 1
Name: wille
Date: November 3, 2007 at 09:05:46 Pacific
Reply: (edit)

Do u just want a program that renames a file or, that removes a phrase like "mywebsite" from all the filename u type in or something like that?


Report Offensive Follow Up For Removal

Response Number 2
Name: tj007s13
Date: November 3, 2007 at 10:34:31 Pacific
Reply: (edit)

I want to take out the phrase out of the file name. (wesite.example.jpg) I do however want to keep the ending portion of the file name (example.jpg)


Report Offensive Follow Up For Removal

Response Number 3
Name: tonysathre
Date: November 3, 2007 at 11:12:08 Pacific
Reply: (edit)

@echo off
for /f "tokens=1-3 delims=." %%a in ('dir /b *.jpg') do rename %%a.%%b.%%c %%b.%%c

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 4
Name: tj007s13
Date: November 3, 2007 at 11:30:50 Pacific
Reply: (edit)

Ok thanks. Some are also _ (underscores) instead of periods. Would it be something like this:

@echo off
for /f "tokens=1-3 delims=_" %%a in ('dir /b *.jpg') do rename %%a_%%b_%%c %%b_%%c

??


Report Offensive Follow Up For Removal

Response Number 5
Name: tonysathre
Date: November 3, 2007 at 15:21:00 Pacific
Reply: (edit)

Yes, that would work.

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal







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








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software