From b455b545779836e6fb2ff69717e6b0a26e23e2cc Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Mon, 25 Oct 2010 23:31:40 +0200 Subject: [PATCH] Add helper for finding files in folder --- mopidy/utils/path.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mopidy/utils/path.py b/mopidy/utils/path.py index 0dd163ec..e73258ea 100644 --- a/mopidy/utils/path.py +++ b/mopidy/utils/path.py @@ -26,3 +26,9 @@ def path_to_uri(*paths): if sys.platform == 'win32': return 'file:' + urllib.pathname2url(path) return 'file://' + urllib.pathname2url(path) + +def find_files(folder): + for dirpath, dirnames, filenames in os.walk(folder): + for filename in filenames: + dirpath = os.path.abspath(dirpath) + yield os.path.join(dirpath, filename)