Help - Search - Members - Calendar
Full Version: Move script.
Linuxhelp > Support > Programming in Linux
I have a program that makes png images in a folder, and ever 24 hours or so i want to move them to a new folder via cron job, how could this be done?
basicaly the format wants to be:

mkdir /home/test/*currect date*
mv -rf /home/test/*.png *current date (folder i just made)
cp -rf /home/orign/*.png /home/test

and i want it to basicaly do this process Every 24/7 via cron job.

Any one got any idea? i think i have the basics, but how would i get variable to make the folder as the current date? just by the server clock.
Something like
mkdir /home/test/`date +%y%m%d`

You can also create a variable like
DATE=/home/test/`date +%y%m%d`
and use it for all commands.

Look at the date man pages to change the format as desired.
Thanks, helped alot, sorted!
just need to see if tthe cron works!
Make sure you include the entire path to your script in the crontab entry.
30 01 * * * /path/to/script/mv_script
do i need the ./path_to_script/
If the . was not a typo then No. The . i.e. ./ means run from current working directory. cron has a limited environment and so you need to use the complete path.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.