[Windows:] Rename all the content files to include the language code

I run my development server localy on Windows.

With https://getkirby.com/docs/languages/setup we know:

###Attention! Switching from single-language to multi-language
If you start with a single language setup and wish to switch to
multiple languages later, you have to rename your text files to include
the language code.

For a bigger website I had to change many filenames. Therefore I have build an script.

Use this script at your own risk!

 

If you want to use this script, first make a backup of your whole site!!!

Then make a new file run_once.cmd in the root of your Kirby installation like:

@ECHO OFF
ECHO %0
ECHO.
REM First adjust the following two lines to fit your needs!
SET content_file_extension=txt
SET default_language=de
REM End of adjustment lines.
ECHO Renames all content files *.%content_file_extension% to the default language "%default_language%".
ECHO.
ECHO First make an backup of your site!!!
ECHO This is currently only a simulation. Delete the word "echo" in the line starting with the word "FOR" for acting!
ECHO Then run it only _ONCE_!!!
ECHO.
ECHO Use this script at your own risk!
ECHO.
PAUSE
FOR /R content\ %%G IN (*.%content_file_extension%) DO echo REN %%G *.%default_language%.%content_file_extension%
PAUSE

Then adjust the two lines starting with β€œSET” to fit your needs (e.g. if your default language is different from β€œde”!).

Now you can double click the file. After a first hit of the RETURN key, you will see, which files would be changed.

But at this point this is only a simulation. Delete the word β€œecho” in the line starting with the word β€œFOR” for acting!
After that run this script only once !!!
Then delete this file run_once.cmd to stop any further run of this script!

Good luck!