Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-29-2003, 04:28 AM
|
#1
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat, FreeBSD
Posts: 20
Rep:
|
Expect Script
#!/usr/local/bin/expect
set User "updates"
set Password "updates"
set Prompt "ftp>"
set Host "ftp.freedomain.com"
set Yes "prompt"
set Local "/home/ryan/parsedlogs/"
#set Yehey "mput yehey*"
################################################# Connect to FTP
spawn "/home/ryan/parsedlogs"
spawn ftp $Host
################################################# Username
expect "Name (ftp.freedomain.com:ryan):"
send "$User\n"
################################################# Password
expect "Password:"
send "$Password\n"
################################################# Enter Command Option of FTP
#expect "$Prompt"
#send "passive\n"
expect "$Prompt"
send "$Yes\n"
expect "$Prompt"
send "hash\n"
################################################# Upload yeheylogs files
expect "$Prompt\n"
send "mput $Local*.*\r"
expect "$Prompt"
send "ls -al\n"
expect "$Prompt\n"
send "bye\n"
and when i run the script it says
spawn /home/ryan/parsedlogs
couldn't execute "/home/ryan/parsedlogs": permission denied
while executing
"spawn "/home/ryan/parsedlogs""
(file "/home/ryan/scripts/ftptest.exp" line 10)
|
|
|
07-29-2003, 12:22 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
What are the permissions on that file?
ls -la /home/ryan/parsedlogs
Who are you running the script as?
|
|
|
07-29-2003, 10:24 PM
|
#3
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat, FreeBSD
Posts: 20
Original Poster
Rep:
|
Hi David_Ross thanks for reply
the permission is
drwxr-xr-x 2 root root 4096 Jul 28 09:57 parsedlogs
The script is running as a root I think  I'm not sure how do i set it to run as a root always... I'm kinda new in scripting
Thanks
|
|
|
07-29-2003, 10:28 PM
|
#4
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat, FreeBSD
Posts: 20
Original Poster
Rep:
|
Hi David_Ross,
When i comment the line 9 #spawn "/home/ryan/parsedlogs" it run but the says:
ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> mput /home/ryan/parsedlogs/*.*
local: /home/ryan/parsedlogs/yeheylogs.2003071819171058527061 remote: /home/ryan/parsedlogs/yeheylogs.2003071819171058527061
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072419031059044582 remote: /home/ryan/parsedlogs/yeheylogs.2003072419031059044582
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072519541059134083 remote: /home/ryan/parsedlogs/yeheylogs.2003072519541059134083
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072519591059134350 remote: /home/ryan/parsedlogs/yeheylogs.2003072519591059134350
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072613591059199175 remote: /home/ryan/parsedlogs/yeheylogs.2003072613591059199175
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072617141059210868 remote: /home/ryan/parsedlogs/yeheylogs.2003072617141059210868
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072617531059213223 remote: /home/ryan/parsedlogs/yeheylogs.2003072617531059213223
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072618361059215790 remote: /home/ryan/parsedlogs/yeheylogs.2003072618361059215790
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072817571059386223 remote: /home/ryan/parsedlogs/yeheylogs.2003072817571059386223
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
I dont think there's no file, the script cant upload it... I don't Get it...
|
|
|
08-16-2003, 09:58 AM
|
#5
|
LQ Newbie
Registered: Aug 2003
Posts: 1
Rep:
|
Hi, Coolest,
I believe you forget to check if remote server has the same
path "/home/ryan/parsedlogs". If you really need that path,
you can use "send "mkdir $path" to create it, or not, you
You need add some sentences before <send "mput..." >:
send "cd $DESTINATION_PATH" #change remote working path.
expect "ftp>"
send "lcd /home/ryan/parsedlogs\" # change local working path.
expect "ftp>"
send "mput *.*\r"
expect "ftp>"
Also please don't use < expect "ftp>"> like above, because no matter failure or success result always give you ftp>.
Quote:
Originally posted by coolest
Hi David_Ross,
When i comment the line 9 #spawn "/home/ryan/parsedlogs" it run but the says:
553 Could not determine cwdir: No such file or directory.
local: /home/ryan/parsedlogs/yeheylogs.2003072817571059386223 remote: /home/ryan/parsedlogs/yeheylogs.2003072817571059386223
200 PORT command successful.
553 Could not determine cwdir: No such file or directory.
I dont think there's no file, the script cant upload it... I don't Get it...
|
|
|
|
02-06-2008, 08:50 AM
|
#6
|
Member
Registered: Jul 2007
Location: Carrollton, Texas
Distribution: cent os 7 , windows 7
Posts: 83
Rep:
|
Hmm Reponse
Just wondering if anyone has gotton rid of cwdir error ? Im receiving this when trying to transfer a file?
|
|
|
03-25-2008, 02:33 PM
|
#7
|
LQ Newbie
Registered: Mar 2008
Posts: 1
Rep:
|
Quote:
Originally Posted by vande012
Just wondering if anyone has gotton rid of cwdir error ? Im receiving this when trying to transfer a file?
|
Hi,
cwdir error occurs when the file which you are ftpying is not found.
Do not use *.* if using 'put',and if you using mput, give 'filename.*' instead of '*.*'.
Let us know if you stil have problem in doing ftp.
|
|
|
02-16-2009, 03:59 PM
|
#8
|
LQ Newbie
Registered: Feb 2009
Posts: 1
Rep:
|
Getting Could not determine cwdir: No such file or directory. error
Hi,
Can someone please help me. I am trying to do ftp using a script and getting error as Could not determine cwdir: No such file or directory.
The code in the script is as below:
FILE="/home/file1.txt"
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
bye
END_SCRIPT
|
|
|
All times are GMT -5. The time now is 08:28 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|