Find the answer to your Linux question:
Results 1 to 5 of 5
Code: #!/bin/bash HOST='********' USER='********' PASSWD='********' #for file in `find /root/upload/ -name *.flv`; do for FILE in /root/upload/; do if [ -d $FILE ]; then cd /root/upload/$FILE ftp -n -v $HOST ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4

    error using FTP when using for each folder

    Code:
    #!/bin/bash
    
    HOST='********'
    USER='********'
    PASSWD='********'
    
    #for file in `find /root/upload/ -name *.flv`; do
    
    for FILE in /root/upload/; do
            if [ -d $FILE ]; then
                    cd /root/upload/$FILE
                    ftp -n -v $HOST << EOT
                    ascii
                    user $USER $PASSWD
                    prompt
                    cd vids/new/$FILE
                    mput *
                    bye
                    EOT
            fi
    done
    this errors out: line 25: syntax error: unexpected end of file
    Last edited by ucstreaming; 03-24-2009 at 03:51 PM. Reason: password in script

  2. #2
    Linux Newbie Sangal-Arun's Avatar
    Join Date
    May 2006
    Location
    Gurgaon, India + Denver Colorado USA
    Posts
    101

    Lightbulb

    Is that error coming because... the here document keyword which you have given "EOT" against FTP command is "NOT" terminated successfully.

    Here document keyword end word (EOT) --->>> should <<<----- start as the first keyword on the next line.

    May be this will solve your problem.
    Brgds,

    ARUN SANGAL
    SCM: 1- 720 251 9962
    Email: sangal.ak04@gmail.com
    Email: sangal_ak04@yahoo.com

  3. #3
    Linux Newbie Sangal-Arun's Avatar
    Join Date
    May 2006
    Location
    Gurgaon, India + Denver Colorado USA
    Posts
    101
    hAli@himashuali]$ cat 1.sh
    #!/bin/bash

    for FILE in /projects/stp/home/stptest_user_workspaces/a_sangal;
    do
    if [ -d $FILE ]; then
    cd $FILE;
    ftp -n -v himanshu.ali.com << EOT
    ascii
    user "Himanshu\\Ali" "Giga123"
    prompt
    cd 2004\ Projects
    mput 1/*
    bye
    EOT
    fi
    done
    Brgds,

    ARUN SANGAL
    SCM: 1- 720 251 9962
    Email: sangal.ak04@gmail.com
    Email: sangal_ak04@yahoo.com

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4
    you might want to take your password out of the script above. ... and thanks

  5. #5
    Linux Newbie Sangal-Arun's Avatar
    Join Date
    May 2006
    Location
    Gurgaon, India + Denver Colorado USA
    Posts
    101

    Thumbs up

    thanks - That's just a fake userid, but i hope your problem would have been resolved.
    Brgds,

    ARUN SANGAL
    SCM: 1- 720 251 9962
    Email: sangal.ak04@gmail.com
    Email: sangal_ak04@yahoo.com

Posting Permissions

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