For rename your files:
Use a for loop command to list your files with numbers in the extension recursively, and, where found, rename them.
1) Use the command Where.exe
with /r
(recursively) in the root directory tree (.
) of your files and filtering only files with exactly 3 characters (???) in the extension...
where.exe /r . *.???
2) Run the where.exe
command redirecting the output to findstr
, where you are using a regex (\.[0-9]*
), so that you can get exactly the files in which the last 4 characters with numbers match precisely that range of .000
to .999
.
- Obs.: Regex:
"\" + "."
== "\." == literal "."
^|%__APPDIR__%findstr.exe /re \.[0-9]*
3) The loop variable returns the files resulting from the filters previously applied and with their full path accessible in %~i
, leaving only the action to rename them, keeping the current name (%~ni
) and adding the desired extension (.txt
).
')do rename "%%~i" "%%~ni.txt"
- Your command to rename only the files that contain numbers in the extension, which can occur from 0 to 999 with leading zeros recursively, looks like this:
for /f tokens^=* %i in ('%__APPDIR__%where.exe /r . *.??? ^|%__APPDIR__%findstr.exe /re \.[0-9]*')do @echo/ren "%~i" "%~ni.txt"
- Your bat/cmd file to rename only the files that contain numbers in the extension, which can occur from 0 to 999 with leading zeros recursively, looks like this:
@echo off
cd /d "D:\folder\target\"
for /f tokens^=* %%i in ('
%__APPDIR__%where.exe /r . *.??? ^|%__APPDIR__%findstr.exe /re \.[0-9]*
')do rename "%%~i" "%%~ni.txt"
With regard to associating file with .numbers
in your extension to MS Excel...
The action of assigning association to MS Excel to open files with numeric extension, I believe, is not recommended, if you really want to do that, I suggest that before
make this a new question, where you would get an accurate and secure answer, supported by one of the experienced and trained users of this community. ...
- I certainly do not recommend doing this action ...
Anyway, excuse me, I prefer not to recommend it, because the compressors / unzips them to handle compressed files in several volumes, and this action can result in something that is not good at some point.