+ 1
How can I rename a bunch of files and give them individual names? C++ and/or python
Hi all. I often have many jpg and png files which I want to rename. I have a list of names which should replace the automatically created name. So for example "file1.jpg" should replaced by "xy_number1_name1" and so on. I have Visual Studio and it would be great to do it with c++ or Python. Thanks for your help.
2 Respostas
+ 7
C++ has std::rename() for files.
https://en.cppreference.com/w/cpp/io/c/rename
The next problem would be about figuring out how to iterate through a folder of files,
// e.g. for (File i : Folder) { ... }
I've done it in Java before, but not in C++. A one-minute lookup into the documentations give information about std::filesystem. It works, but is exclusive to C++17 (perhaps also C++14 on experimental config).
https://en.cppreference.com/w/cpp/filesystem/directory_iterator
Python? Probably very easy, but I don't know. :P
+ 1
Maybe you can use a external tool like totalcommamder? or a opensource libary that support file management.