Skip to content

Instantly share code, notes, and snippets.

@kanghyojun
Created April 2, 2014 08:03
Show Gist options
  • Select an option

  • Save kanghyojun/9929874 to your computer and use it in GitHub Desktop.

Select an option

Save kanghyojun/9929874 to your computer and use it in GitHub Desktop.
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