Results 1 to 7 of 7

Thread: copy new files

  1. #1
    Join Date
    Feb 2013
    Beans
    3

    copy new files

    Hello,

    i'm looking to create a (i think) very simple script, but i just started on ubuntu and haven't got a clue how to get it to work.

    I have a folder which recieves new files from other parts in my network. I need to do some processing on those files but now and then something goes wrong in that process and i loose files. to be sure of my system i need to have a script which watches a directory and copies any new files in it to another directory. every file/folder just needs to be copied once (when it just got into the directory).
    is there an easy way to do this?


    it's on a fresh install of ubuntu server 12.04

  2. #2
    Join Date
    Oct 2006
    Beans
    58,286

    Re: copy new files

    Thread moved to the "Server Platforms" forum.

  3. #3
    Join Date
    Feb 2013
    Beans
    3

    Re: copy new files

    whohoo not beginner enough for the absolute beginners section apparently

  4. #4
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: copy new files

    Welcome to the Ubuntu Forums

    I hope you are ready for rsync. See the well written manual
    Code:
    man rsync
    , where you can find what you need.

    Code:
    rsync -avn source-directory/ target-directory
    will list what is new (and needs to be copied)
    Code:
    rsync -av source-directory/ target-directory
    will do the copying.

    If you want it done automatically, make a cron job of it!

  5. #5
    Join Date
    Nov 2006
    Location
    Belgium
    Beans
    3,025
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: copy new files

    Quote Originally Posted by sudodus View Post
    If you want it done automatically, make a cron job of it!
    if you want it done automatically on every change (triggered, rather than scheduled), you might want
    this http://linux.about.com/library/cmd/blcmdl1_watch.htm
    or
    this http://www.cyberciti.biz/faq/linux-i...e-directories/

  6. #6
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: copy new files

    incron seems to be a very good alternative

  7. #7
    Join Date
    Feb 2013
    Beans
    3

    Re: copy new files

    thnx for the help, got it working

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •