Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detecting file extensions
#1
How do i make python listen for changes to a folder on my desktop, and every time a file was added, the program would read the file name and categorize it it based on the extension?

This is a part of a more detailed program but I don't know how to get started on this part. This part of the program detects when the user drags a file into a folder on his/her desktop and then moves that file to a different location based on the file extension
Reply
#2
you can use package like watchdog to monitor your folder for changes, then using os.path.splitext() or pathlib's PurePath.siffix get the file extension and process the file accordingly
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  iterating and detecting the last Skaperen 3 1,029 Oct-01-2022, 05:23 AM
Last Post: Gribouillis
  Detecting float or int in a string Clunk_Head 15 4,277 May-26-2022, 11:39 PM
Last Post: Pedroski55
  module detecting if imported vs not Skaperen 1 1,637 Nov-19-2021, 07:43 AM
Last Post: Yoriz
  detecting a generstor passed to a funtion Skaperen 9 3,465 Sep-23-2021, 01:29 AM
Last Post: Skaperen
  Python BLE Scanner not detecting device alexanderDennisEnviro500 0 1,972 Aug-01-2021, 02:29 AM
Last Post: alexanderDennisEnviro500
  Detecting power plug Narayan 2 2,673 Aug-01-2020, 04:29 AM
Last Post: bowlofred
  Detecting USB Device Insertion on Windows 10 Atalanttore 0 2,338 Jan-17-2020, 02:46 PM
Last Post: Atalanttore
  Detecting windows shutdown event riccardoob 4 5,622 Nov-12-2019, 04:51 PM
Last Post: Aurthor_King_of_the_Brittons
  Detecting String Elements in a List within Given Message Redicebergz 6 3,756 Mar-19-2019, 03:12 PM
Last Post: buran
  Detecting if image matches another kainev 2 2,864 Dec-02-2018, 02:00 PM
Last Post: kainev

Forum Jump:

User Panel Messages

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