Created
November 17, 2013 12:49
-
-
Save keimina/7512965 to your computer and use it in GitHub Desktop.
Find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import re | |
import editor | |
import console | |
home_dir = os.path.dirname(__file__) | |
current_dir = os.path.dirname(editor.get_path()) | |
current_dir = os.path.relpath(current_dir, home_dir) | |
l = os.walk(current_dir) | |
file_name_list = (map(lambda y: os.path.join(x[0], y), x[2]) for x in l if x[2] != []) | |
file_name_list = (item for sublist in file_name_list for item in sublist) | |
s = console.input_alert('Enter file name(regex)') | |
for filename in file_name_list: | |
if re.search(s, os.path.basename(filename), flags=re.IGNORECASE): | |
print filename | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment