Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I want to backup files and images that are 30 days, 60 days old and so on.. My script below finds all files on a certain directory ($DIR) that ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Location
    CA
    Posts
    5

    Smile backing up older files using "find" and "scp"

    Hi,

    I want to backup files and images that are 30 days, 60 days old and so on.. My script below finds all files on a certain directory ($DIR) that are X old days, but the scp command copies all files where I ran the script. I ran it under /home/Files_to_be_Moved/, all files under this folder were moved to the remove /home/data, not only the 30 day or 60 day old files. Can anybody help me? I just want to scp the files found by the "find" command on the script.

    find $DIR -type f -mtime +$DAYS -exec scp -r -p -P22000 user@192.168.10.254:/home/data/ \; &

    tia

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Try:

    Code:
    find $DIR -type f -mtime +$DAYS -exec scp -r -p -P22000 {} user@192.168.10.254:/home/data/ \; &
    Regards

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Location
    CA
    Posts
    5
    Quote Originally Posted by Franklin52 View Post
    Try:

    Code:
    find $DIR -type f -mtime +$DAYS -exec scp -r -p -P22000 {} user@192.168.10.254:/home/data/ \; &
    Regards
    thanks frank am trying it right now..

  4. #4
    Just Joined!
    Join Date
    May 2008
    Posts
    15
    hi rudysc,
    is this command working? or u have any alternate method?

    Regards,
    Madhi

Posting Permissions

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