简体   繁体   中英

Adding file extensions to files without them in Windows

I am trying to add file extensions to a large number of files located in a series of folders and subfolders in Windows. For some reason, these files do not have a file extension on them and I need them to have the extension .ddd so I can convert them to PDFs using a separate program.

cd R:\PRODUCTION\92 
ren *. *.ddd

Note that this command does indeed work but only on folders that actually contain the files I need, and no subfolders. What could I add or change to hit all files in all subfolders? Thanks in advance.

Please try the following command. If it looks like it will do the correct rename, remove the ECHO from the REN command line.

CD /D R:\PRODUCTION\92
FOR /F "delims=" %f IN ('DIR /S /B /A:-D "*."') DO (ECHO REN "%~f" "%~nf.ddd")

In a .bat file script, double the percent character on the variable.

CD /D R:\PRODUCTION\92
FOR /F "delims=" %%f IN ('DIR /S /B /A:-D "*."') DO (ECHO REN "%%~f" "%%~nf.ddd")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM