Python Forum
how to open folder and change files in it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to open folder and change files in it
#1
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
Reply
#2
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().
Reply
#3
Thanks snippsat for answer , that's I want , the module
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Right way to open files with different encodings? Winfried 2 168 Yesterday, 05:50 PM
Last Post: snippsat
  Open files in an existing window instead of new Kostov 2 301 Apr-13-2024, 07:22 AM
Last Post: Kostov
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 551 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  open python files in other drive akbarza 1 691 Aug-24-2023, 01:23 PM
Last Post: deanhystad
  Rename files in a folder named using windows explorer hitoxman 3 741 Aug-02-2023, 04:08 PM
Last Post: deanhystad
  change directory of save of python files akbarza 3 887 Jul-23-2023, 08:30 AM
Last Post: Gribouillis
  Rename all files in a folder hitoxman 9 1,494 Jun-30-2023, 12:19 AM
Last Post: Pedroski55
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 887 Jun-26-2023, 09:40 AM
Last Post: snippsat
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 966 Feb-15-2023, 05:34 PM
Last Post: zsousa
  How to loop through all excel files and sheets in folder jadelola 1 4,497 Dec-01-2022, 06:12 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020