Quantcast
Channel: Howtos & more …– LANbugs
Viewing all articles
Browse latest Browse all 144

Python: Snippet – Liste mit allen Dateien rekursiv aus einem Ordner

$
0
0

Das Beispiel gibt eine Liste mit allen Dateien und dem vollen Pfad zur Datei in allen Ordnern zurück.

import glob
import os

path = "/etc"
files = glob.glob(os.path.join(path, "**/*"), recursive=True)
result_files = [f for f in files if os.path.isfile(f)]

Viewing all articles
Browse latest Browse all 144