Python script to search for file names
by secretleakbuyer - Tuesday June 13, 2023 at 10:57 AM
#1
=========================================================================================
Part-1

import os

for i in os.walk("PATH_TO_DIR"):
    for fn in i[2]:
        if any(m in fn for m in ["DVD", "RIP", "R5"]) and (".avi" in fn or ".mkv" in fn):
            print(os.path.join(i[0], fn))


Using pathlib.

from pathlib import Path

# find files
files = Path.cwd().glob('filename.*')

# find files with REGex
files = Path.cwd().rglob('**/mnt/folder/Movies/*RIP*|*R5*')

==============================================================================
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Useful links for developers Manfruity 36 2,356 Apr 24, 2026, 06:54 PM
Last Post: Weirdtatsum30777
  ⭐ Sektor7 - All courses (6 in total) ⭐ red_dot 599 38,579 Apr 23, 2026, 09:51 PM
Last Post: cwel321
  Discord Token Grabber | Private Stealer | Leaked For Free Piplup 351 57,828 Apr 21, 2026, 11:51 PM
Last Post: OldeChicago93
  WEBSITES FOR FREE INSTAGRAM FOLLOWERS ⭐ UHQ Moneygain 101 10,432 Feb 10, 2026, 03:02 PM
Last Post: onionX232
  How to buy crypto without KYC Manfruity 40 2,163 Feb 09, 2026, 10:55 PM
Last Post: Stevemox2

Forum Jump:


 Users browsing this forum: 1 Guest(s)