0

I am bit clueless where to start. I am looking for a solution

a) copy a particular file from folder A/ to B/ @ fix day/time b) copy a random file from folder A/ to B/ @ fix day/time

Any hint how to start would be really appriciated

CI

hlovdal
  • 23,353
  • 10
  • 78
  • 148
  • are you writing a virus??? for me I would write a python script and append it is as a crontab I would loop all the files in a list and random an index in folder A and copy it to B – Hamuel Aug 23 '17 at 15:42
  • Not a virus! :-) It´s going to be a random picture + pre-defined message to be displayed on a screen. – Confluentes Info Aug 23 '17 at 16:09

1 Answers1

0

Copying a specific file from A to B can be achieved by appending a line to your crontab depending on the time you want it to run. The general syntax will be:

minute hour dayOfMonth month dayOfWeek (command to be executed)

In your case the command to be executed will be like:

cp /path/to/file/to/be/copied /path/to/destination

For eg.: If you want to copy the file at 3:35 PM(15:35) on 20th of November then your command will be like

35 15 20 11 * cp /path/to/file/to/be/copied /path/to/destination

Check out this wikipedia link for an excellent explanation on setting up cron jobs.

Sarath S Menon
  • 1,461
  • 10
  • 19