Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Daily i wanna copy some files from a remote system and i have to put all those files in on a folder on that date say enter image description here.Is it possible to automate this task? What we do presently is we log on to the remote machine through VNC and we go to the preferred location and copy those files and put it on a folder.If some day we forget this we wont be able to take records for that day coz the files will be overwritten.So i would like to automate this task, is it possible? Can someone help me please.Thanks in adavance..

Note: The remote system runs Windows XP Professional

share|improve this question
up vote 1 down vote accepted

You can take the Windows-being-useless issue out of the equation very simply: create a share and mount it on your Linux machine (with smbfs or CIFS). It's fairly simple so I'll leave that between you and the Ubuntu Help Pages.

From there it's fairly simple:

  1. Create a script. Call it something logical, put it somewhere where you won't trip over it or accidentally move it. chmod +x it too.

  2. Get your script to do what you want. I'll assume you mounted your writable Windows share as /mnt/win (mount it under /mnt/ if you don't want it show up in nautilus) and that you want these directories stored in ~/daily-backups/.

    DATE=$(date '+%Y-%m-%d')
    # make the new directory for today and cd into it
    mkdir -p "$NEWDIR"
    cd "$NEWDIR"
    cp -R "$SRC/*" . # could use rsync
  3. cron it up. Assuming your script is called ~/daily-backups/do-backups. Type crontab -e and in the editor add a new line like this:

    0 22 * * * ~/daily-backups/do-backups

    And that will run your script every day at 10pm. Obviously you might want to tune that to a more sentible time but I wouldn't leave it until midnight or the datestamp might get confusing.

share|improve this answer
Great answer i will try it, Thank you :) – karthick87 May 1 '11 at 4:07
I am unable to mount the windows drive, can you pls help? The windows machine is connected to domain. So tell me how to mount it ? – karthick87 May 5 '11 at 13:23

If you can put Cygwing on that Windows box then rsync (over ssh) and cron would be the standard solution.

It's not easy.

Search for "backups with rsync", this would come up first: - a really good resource. Explains how to setup backups with snapshots (timestamps).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.