Skip to content

Instantly share code, notes, and snippets.

@JohnPreston
Created October 11, 2016 15:42
Show Gist options
  • Save JohnPreston/0c7e040c899f5f3f059b4d1e3a3ff1d5 to your computer and use it in GitHub Desktop.
Save JohnPreston/0c7e040c899f5f3f059b4d1e3a3ff1d5 to your computer and use it in GitHub Desktop.
Recursive function to find all fines full paths
def get_filenames(search_path=None):
"""
List all files under .git
:return:
"""
intab = '\\'
outtab = '/'
transtab = maketrans(intab, outtab)
files_list = []
print "Ignoring files in %s" % search_path
for item in os.listdir(search_path):
if os.path.isfile(os.path.abspath("%s%s" % (search_path, item))):
unix_style_path = os.path.abspath("%s%s" % (search_path, item)).translate(transtab)
files_list.append(unix_style_path)
elif os.path.isdir("%s/%s" % (search_path, item)):
extra_files = get_filenames("%s%s/" % (search_path, item))
for extra_item in extra_files:
files_list.append(extra_item)
return files_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment