Home > Mobile >  Change file extension without specific files
Change file extension without specific files

Time:01-12

I want to write a batch file script that change the files extensions without changing the extension of files that are already .jpg, for example.

I have this until now: ren "I know that here comes what will be evaluated" *.jpg.

BTW, some files that I want to change have no extension, and I don't know how to also evaluate these files.

The files that don't have extension:

Properties dialog of one of those files:

CodePudding user response:

You can use forfiles for finding all files without extension, hereby an example of how to use it:

FORFILES /C "cmd /c if @isdir==FALSE echo ""file=""@file" ""fname=""@fname" ext=""@ext"

Files without extension will look like this example:

"file="xaa" "fname="xaa" ext="""
"file="xab" "fname="xab" ext="""
"file="xac" "fname="xac" ext="""
...

More information can be found via forfiles /?.

CodePudding user response:

What about ren * *.jpg? This will result in errors if you have two files with the same name but different extensions as test and test.jpg. This command will try to rename test to test.jpg but this file already exists.

  • Related