0

I have multiple files in a directory, ending with the same name *.html.html, I'm looking for a way to get their names and change them to just *.html using the rename() function in c or c++ or any other way to solve this problem

taras
  • 6,566
  • 10
  • 39
  • 50

1 Answers1

-1

In command line, simply use:

ren *.html.html *.html

Or, in PowerShell:

Dir *.html.html | rename-item -newname { [io.path]::ChangeExtension($_.name, "html") }

Shell would be the simplest option and the most sensate to use. Using C would be overkilling it. Any scripting language (python, php) would be a simpler solution.

If you really really just want to do it in C, you can have a look at this SO question: How do I loop through all files in a folder using C?

brunorey
  • 2,135
  • 1
  • 18
  • 26