G
Greg Brondo
Here's the error I receive now (after Guy fixing my first issue):
c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `readline': End of file reached
(EOFError)
from c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `getline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:221:in `getmultiline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:235:in `getresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:251:in `voidresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:433:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `synchronize'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:628:in `list'
... 6 levels...
from C:/src/ruby/chmod/ftp_chmod.rb:13:in `chmodFiles'
from C:/src/ruby/chmod/ftp_chmod.rb:35
from C:/src/ruby/chmod/ftp_chmod.rb:33:in `open'
from C:/src/ruby/chmod/ftp_chmod.rb:33
Dunno why I'm getting the EOF. Same basic logic works great in PHP and
Python. Any help would be greatly appreciated.
Here's the code:
require 'net/ftp'
def printInfo(msg)
puts Time.now.to_s + " :: #{msg}"
end
def chmodFiles(conn, dir)
conn.chdir(dir)
pwd = conn.pwd()
dirList = conn.list()
printInfo("file count = #{dirList.length}")
dirList.each() { |entry|
fileName = entry.split()[8]
if entry =~ /^d/ # It's a directory
printInfo(pwd)
chmodFiles(conn, fileName)
conn.chdir("..")
end
}
end
## Main
HOST = ARGV[0] || "localhost"
PERMISSIONS = ARGV[1] || "0775"
STARTDIR = ARGV[2] || "."
printInfo("Permissions = #{PERMISSIONS}")
printInfo("Start Dir = #{STARTDIR}")
Net::FTP.open(HOST) { |conn|
conn.login("blahuser", "blahpass")
chmodFiles(conn, STARTDIR)
}
c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `readline': End of file reached
(EOFError)
from c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `getline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:221:in `getmultiline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:235:in `getresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:251:in `voidresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:433:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `synchronize'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:628:in `list'
... 6 levels...
from C:/src/ruby/chmod/ftp_chmod.rb:13:in `chmodFiles'
from C:/src/ruby/chmod/ftp_chmod.rb:35
from C:/src/ruby/chmod/ftp_chmod.rb:33:in `open'
from C:/src/ruby/chmod/ftp_chmod.rb:33
Dunno why I'm getting the EOF. Same basic logic works great in PHP and
Python. Any help would be greatly appreciated.
Here's the code:
require 'net/ftp'
def printInfo(msg)
puts Time.now.to_s + " :: #{msg}"
end
def chmodFiles(conn, dir)
conn.chdir(dir)
pwd = conn.pwd()
dirList = conn.list()
printInfo("file count = #{dirList.length}")
dirList.each() { |entry|
fileName = entry.split()[8]
if entry =~ /^d/ # It's a directory
printInfo(pwd)
chmodFiles(conn, fileName)
conn.chdir("..")
end
}
end
## Main
HOST = ARGV[0] || "localhost"
PERMISSIONS = ARGV[1] || "0775"
STARTDIR = ARGV[2] || "."
printInfo("Permissions = #{PERMISSIONS}")
printInfo("Start Dir = #{STARTDIR}")
Net::FTP.open(HOST) { |conn|
conn.login("blahuser", "blahpass")
chmodFiles(conn, STARTDIR)
}