Remove file extensions from a list of files

Barfo

Lifer
Jan 4, 2005
27,539
212
106
Hi,

I have a text file with a list of filenames, is there an easy way to remove the file extensions, which are of variable length?
 

abekl

Senior member
Jul 2, 2011
264
0
71
It would be easy in MS word or other word processor. Just record a macro that searches for a period, then deletes the next three characters. Repeat.
 

Barfo

Lifer
Jan 4, 2005
27,539
212
106
It would be easy in MS word or other word processor. Just record a macro that searches for a period, then deletes the next three characters. Repeat.

duh, why didn't I think of this?
thanks !
 

Gooberlx2

Lifer
May 4, 2001
15,381
6
91
If you use something like notepad++, use regex search/replace.

search: \.\w*$
replace: <blank>

Tackles variable length and zero length extensions.

Translation:
\. <-- literal dot (as opposed to wildcard dot)
\w <-- any word character (a-z, A-Z, 0-9)
* <-- match last indefinitely, zero or more times.
$ <-- end of line anchor. This prevents the search from including filenames with dots. (i.e. my.text.file.txt)
 
Last edited: