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 ...
- 03-24-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 4
error using FTP when using for each folder
this errors out: line 25: syntax error: unexpected end of fileCode:#!/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 doneLast edited by ucstreaming; 03-24-2009 at 03:51 PM. Reason: password in script
- 03-24-2009 #2
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.
- 03-24-2009 #3
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
- 03-24-2009 #4Just Joined!
- Join Date
- Mar 2009
- Posts
- 4
you might want to take your password out of the script above. ... and thanks
- 03-24-2009 #5
thanks - That's just a fake userid, but i hope your problem would have been resolved.


Reply With Quote