Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os, fnmatch
- def find(pattern, path):
- result = []
- for root, dirs, files in os.walk(path):
- for name in files:
- if fnmatch.fnmatch(name, pattern):
- result.append(os.path.join(root, name))
- return result
- a = find(sys.argv[1], sys.argv[2])
- print(str(a[0])) # Return the 1st result as string (change this if you want an array with multiple files)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement