import shutil
import os
import logging
source = '/var/spools/asterisk/monitor'
dest1 = '/tmp/'
files = os.listdir(source)
for f in files:
shutil.move(source+f, dest1)
logging.basicConfig(filename='app.log', filemode='w', format='%(name)s
- %(levelname)s - %(message)s')
logging.info('directories moved')
A little bit cooked code with log feature. You can also configure this to run at some period of time using crontab.
* */1 * * * python /home/yourprogram.py > /dev/null 2>&1
runs every hour! cheers