Python Forum
Find all “*.wav” files that created yesterday on linux host with python.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find all “*.wav” files that created yesterday on linux host with python.
#2
This will walk from starting path:
from pathlib import Path


def walk_dir(starting_dir):
    flist = []
    for path in Path(starting_dir).iterdir():
        if path.is_file():
            if path.suffix == '.wav':
                print(path)
                flist.append(path)
        elif path.is_dir():
            walk_dir(path)

    for file in flist:
        print(file)


if __name__ == '__main__':
    start_path = '/home/'
    walk_dir(start_path)
Reply


Messages In This Thread
RE: Find all “*.wav” files that created yesterday on linux host with python. - by Larz60+ - Dec-29-2019, 09:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is possible to run the python command to call python script on linux? cuten222 6 857 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  Find duplicate files in multiple directories Pavel_47 9 3,279 Dec-27-2022, 04:47 PM
Last Post: deanhystad
  How to use a variable in linux command in python code? ilknurg 2 1,648 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  where to host my python script tomtom 1 1,300 Feb-09-2022, 06:45 AM
Last Post: ndc85430
  count every 28 files and find desire files RolanRoll 3 2,139 Dec-12-2021, 04:42 PM
Last Post: Axel_Erfurt
  Have to use Python 2.x to find "yesterday' files tester_V 6 2,931 Sep-19-2021, 12:26 AM
Last Post: tester_V
  Failing to connect to a host with WMI tester_V 6 4,496 Aug-10-2021, 06:25 PM
Last Post: tester_V
  Python syntax in Linux St0rmcr0w 2 56,558 Jul-29-2021, 01:40 PM
Last Post: snippsat
  Logstash - sending Logstash messages to another host in case of Failover in python Suriya 0 1,706 Jul-27-2021, 02:02 PM
Last Post: Suriya
  find 'yesterdays files' tester_V 8 3,987 Jun-18-2021, 02:10 AM
Last Post: tester_V

Forum Jump:

User Panel Messages

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