Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #-*- coding: utf-8 -*-
- import os
- allow_ext = ['mp3', 'wav']
- def list_dir(folder):
- items = os.listdir(folder)
- for item in items:
- abspath = os.path.join(folder, item)
- if(os.path.isdir(abspath)):
- list_dir(abspath)
- else:
- ext = abspath[abspath.rfind('.') + 1 : len(abspath)].lower()
- if ext in allow_ext:
- print abspath
- list_dir("/home/korkeat/Music")
Add Comment
Please, Sign In to add comment