Solved batch to Remove file extentions

September 8, 2016 at 12:35:21
Specs: Windows 7
i have a different question i hope someone can answer.
i would like to remove the files extension all together, i have over a 1,000 files i need to do this with and would like to know how this can be done via batch.

Ex: strong.txt to strong

mark

edited by moderator: removed e-mail address


See More: batch to Remove file extentions

Reply ↓  Report •


#1
September 8, 2016 at 17:30:13
First, I've removed your e-mail address to prevent you from getting spam (we don't communicate via e-mail here, just on the forum).

Second, instead of a batch, why not download BRU to manipulate filenames in multiple ways (including removing extensions)

http://www.bulkrenameutility.co.uk/...

"Channeling the spirit of jboy..."


Reply ↓  Report •

#2
September 8, 2016 at 18:26:42
✔ Best Answer
If all the files are in one directory:
@for /f "tokens=*" %%a in ('dir /b *.*') do echo ren %%a %%~na

This is minimal version. For more options I would need more information. I used "dir" to avoid infinite recursion potential which can happen when dynamic data is being changed dynamically. Not sure if it matters since not tested. I recommend piping this out to a secondary batchfile so you have a record of what you have changed. Then just run that batch. Otherwise, remove "echo" to get immediate result. Also, to consider if two files with same name but different extensions exist, needs to be handled if there is a potential conflict (f/e: two files: test.txt, test.jpg would both be wanting to be "test".)

message edited by nbrane


Reply ↓  Report •

#3
September 8, 2016 at 18:44:48
Easier way to write that, nbrane:
ren *.* *.

Still the same problems[EDIT: Fewer problems. Remember your double quotes!] as your version, including the script renaming itself, but only, what, 10 characters?

How To Ask Questions The Smart Way

message edited by Razor2.3


Reply ↓  Report •

Related Solutions

#4
September 9, 2016 at 01:14:24
Hi T-R-A,

I miss jboy. He threw in the towel after years of harassment by you-know-who.
g'nite john boy

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

#5
September 10, 2016 at 06:53:02
Mechanix2Go
Wow, that reference to jboy is a blast from the past. Good to see you and T-R-A still posting on here.

MarkZ
Please excuse this intrusion.

Always pop back and let us know the outcome - thanks


Reply ↓  Report •

#6
September 10, 2016 at 23:28:43
Hi Derek,

Like the song, still crazy after all these years. S&G

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •


Ask Question