Skip to main content
clarify more detail
Source Link

fullFTP do not have mv command. You have to use rename command

The concept is generate a todo file to rename(move) each file one by one
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 , for demo you can do more actions on text 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#echo >>todo.lst cd /OUT #for demo you can do more actions on text file echo#echo >>todo.lst get $N #for demo you can do more actions on text file echo >>todo.lst rename $N ARCHIVE/$N #did not change file name, move directory only done <list.txt

    echo >>todo.lst quit

    ftp transfer process

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

    cleanup

    rm todo.lst

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

FTP do not have mv command. You have to use rename command

The concept is generate a todo file to rename(move) each file one by one
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 , for demo you can do more actions on text 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 #for demo you can do more actions on text file #echo >>todo.lst get $N #for demo you can do more actions on text file echo >>todo.lst rename $N ARCHIVE/$N #did not change file name, move directory only done <list.txt

    echo >>todo.lst quit

    ftp transfer process

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

    cleanup

    rm todo.lst

Source Link

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