Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2015
    Posts
    1

    Unanswered: How to get files from a folder everyday and store it in another folder using shellscr

    I need to get the files present in a FTP location every day. other condition is I need the files only on that particular day, not in addition with older day files. then store the files in another folder using shell script.

    This is the code i currently have

    #!/bin/bash

    . /apps/promis/prmprd/shells/Cover_Images/dataset.properties

    cd /apps/promis/prmprd/shells/Cover_Images
    HOST='xxx'
    USER='PDD'
    PASSWD='yyyy!'

    echo $HOST



    ftp -n $HOST <<END_SCRIPT
    quote USER $USER
    quote PASS $PASSWD
    bin
    prompt


    find ./ -type f -mtime -1 exec cp {} /apps/promis/prmprd/shells/temp \;


    quit
    END_SCRIPT

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Rather than use the find command, I would be inclined to connect to the remote system twice, first to get a 'ls -l' listing of the source directory, then use that listing to compare to the contents of the target directory, and on the second connection, retrieve only the files that are not present in the target directory.
    If the contents of the target directory change on a daily basis, then move today's remote listing to 'yesterday.list' at the end of the process.
    Some things to consider: What happens to files that are being created on the source system while the ftp is in process or later in the day?

Tags for this Thread

Posting Permissions

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