Python Forum
how to open folder and change files in it - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to open folder and change files in it (/thread-8219.html)



how to open folder and change files in it - ahmadeldawoody - Feb-10-2018

Hi everyone , I am a new member in this froum and need help , I want to develop an app that open a folder in my file system an list files and rename some of these files


RE: how to open folder and change files in it - snippsat - Feb-10-2018

Hi welcome,it's pretty straight forward using the os module.
Here some hints,as we don't write finish solution without some effort from your side.
Read files in a folder os.scandir().
Eg if file.endswith(('.txt', '.jpg')) to choose wanted formats.
Rename files os.rename().


RE: how to open folder and change files in it - ahmadeldawoody - Feb-10-2018

Thanks snippsat for answer , that's I want , the module