how to batch replace the files in a directory windows vista(from .txt.txt to .txt)
-
22-06-2021 - |
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
Please be noted that I need an out of the format filename.txt.
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.