Skip to main content
1 of 2

full script to achieve move more than one file

  1. get file list from ftp server with mls command

  2. generate to do list file
    2.1 get file
    2.2 rename (move file)

  3. execute ftp command with to do list file

    #!/bin/sh clear

    change local directory

    cd [local-directory]

    #collect file names ftp -ni ftp.abccompany.com <<EOF user [user] [password] cd /OUT mls abc*.* list.txt quit EOF

    create ftp action list

    echo >>todo.lst user [user] [password] while read N do echo >>todo.lst cd /OUT echo >>todo.lst get $N echo >>todo.lst rename $N ARCHIVE/$N done <list.txt

    echo >>todo.lst quit

    ftp transfer process

    ftp -nv ftp.abccompany.com <todo.lst

    cleanup

    rm todo.lst