From: Hirokazu Kiuchi Date: 2000-02-08T17:08:30+09:00 Subject: [ruby-list:20594] Re: ftpmirror-1.2.2 で @homepage へ up 不可 きうちです、皆様のおかげでとりあえず対応できそうです ありがとうございます。 On 00/02/08 13:55:14 WATANABE Hirofumi wrote: > > そうそう. 思い出した. @homepage は [ruby-list:20570] な感じ > で変なので "-lLd " にしたのでした. > だからオプションがあったほうがよさそうです. > > -- > わたなべひろふみ > そのほかは思い出せん. "-lLd "で行ったところ、homepage下はOKでしたが サブディレクトリーを作成しているとNGのようです。 homepage ---> "-lLd " それ以下のサブディレクトリー ---> "-lL " ということで対応してみました。 Rubyはど素人の私が作成したものとオリジナルとの差分です。 homepage 決めうちですので、かなりいいかげんですが 自分が持っているもう一つのプロバイダーと兼用で使えているので OKにします。 --- ftpmirror.orig Tue Feb 8 16:56:19 2000 +++ ftpmirror Tue Feb 8 16:57:09 2000 @@ -96,10 +96,16 @@ end def updatedir(directory) - print directory.sub(/^./, Config::REMOTE_DIR), ":\n" + dirname = directory.sub(/^./, Config::REMOTE_DIR) + print dirname, ":\n" remote_dirs = []; remote_filetimes = {} - check_remote_files(directory, remote_dirs, remote_filetimes) + if dirname == "homepage" + ls_opt = "-lLd " + else + ls_opt = "-lL " + end + check_remote_files(directory, remote_dirs, remote_filetimes, ls_opt) Dir.foreach(directory) do |file| longname = directory + "/" + file if file != "." && file != ".." @@ -130,8 +136,8 @@ end end - def check_remote_files(directory, dirs, filetimes) - @ftp.list("-lL "+directory) do |line| + def check_remote_files(directory, dirs, filetimes, ls_opt) + @ftp.list(ls_opt+directory) do |line| unless line =~ /^total/ if line[0] == ?d line =~ /\S+$/ #実は今回、初めてRubyのソースをまともに読みました。 #一応Ruby本もっているんですが、ほとんど読んでません(^^ゞ *----*----*----*----*----*----*----*----*----*----* *** 木内 宏和 kiuchi@nsknet.or.jp