Does anyone know a regular expression that will rename multiple files that have different extensions to have the same extension. For example, you could use this code when several text files exist in a directory but have slightly different extensions such as .txt,. TXT, or text. This expression should show how to rename them to all have .txt extensions.
I understand i will nedd [] the character class so it contains a hypen, dot, slash and w+ d+ to show the filename to be of any charcter and digit
What else do i need to include in the expression?
Regards, David.
No doubt in my mind this is school or class work.
Regular expressions can not rename files, only find the files you are looking for. To rename a file you have to use the rename() function.