View Full Version : [SOLVED] crontab copying files to folder with actual month

October 19th, 2012, 08:59 PM

I need to make a script to crontab what check one folder and copy to another but I want that a file what will be copyed will be copyed to folder what is named to current month.

right now I'm using this crontab script

find /media/-Arhiiv-/0day/2012/ -maxdepth 2 -mindepth 2 -type d -mtime -7 -exec cp -r {} /home/user/Dropbox/Share/ \;

but what i want to make is to use python code like

/home/user/Dropbox/Share/{{ now|formatdate('%Y/%m - %B')}}/

how can I make it work in crontab?

October 19th, 2012, 09:07 PM
not a crontab expert but have you tried formatting the /bin/date command directly - something like this maybe?

/home/user/Dropbox/Share/$(/bin/date '+%B')

October 21st, 2012, 04:54 PM
Thank you, that made the trick :)