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
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 465 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  open python files in other drive akbarza 1 632 Aug-24-2023, 01:23 PM
Last Post: deanhystad
  Rename files in a folder named using windows explorer hitoxman 3 692 Aug-02-2023, 04:08 PM
Last Post: deanhystad
  change directory of save of python files akbarza 3 806 Jul-23-2023, 08:30 AM
Last Post: Gribouillis
  Rename all files in a folder hitoxman 9 1,384 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 815 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 918 Feb-15-2023, 05:34 PM
Last Post: zsousa
  How to loop through all excel files and sheets in folder jadelola 1 4,328 Dec-01-2022, 06:12 PM
Last Post: deanhystad
  python gzip all files from a folder mg24 3 3,807 Oct-28-2022, 03:59 PM
Last Post: mg24
  delete all files and subdirectory from a main folder mg24 7 1,526 Oct-28-2022, 07:55 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

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