Question

I have a couple of flat files(.txt) in a directory.all those files are in the format *.txt.txt so i want to rename it to *.txt ?Is there any simple way to rename all together?

when I tried ren *.txt.txt *.txt is is not working

Any experts please suggest?It is amazing I have not got any answer yet enter image description here

Please be noted that I need an out of the format filename.txt.

Was it helpful?

Solution

This should work

ren *.txt.txt *.

The reason your command didn't work is because, to windows, the file file.txt.txt is called file.txt with a .txt extension.

Only the last extension is the real extension, the first then becomes part of the filename, hence why your command changes it to what it already is.

If you did ren *.txt.txt *.pdf you would get file.txt.pdf.

My command will just remove the last one, thereby leaving the first, which then becomes the only and real extension.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top