Skip to content

Instantly share code, notes, and snippets.

@keimina
Created November 17, 2013 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keimina/7512965 to your computer and use it in GitHub Desktop.
Save keimina/7512965 to your computer and use it in GitHub Desktop.
Find
# -*- 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