Created
April 2, 2014 08:03
-
-
Save kanghyojun/9929874 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| from os import walk | |
| from os.path import join | |
| from threading import Timer | |
| from subprocess import call | |
| from datetime import datetime | |
| def do(f, time, *args): | |
| f(*args) | |
| Timer(time, lambda: do(f, time, *args)).start() | |
| def watch(): | |
| path = '/Users/admire/Desktop/' | |
| watch_file_extension = 'xls' | |
| cp_path = '/Users/admire/Desktop/secret/%s.%s' % (datetime.now(), | |
| watch_file_extension) | |
| for p, _, files in walk(path): | |
| for f in files: | |
| if f.endswith(watch_file_extension): | |
| call(['cp', | |
| join(p, f), | |
| cp_path], shell=True) | |
| if __name__ == '__main__': | |
| do(watch, 50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment