wgetは入れ子になったディレクトリを除外しません。

wgetは入れ子になったディレクトリを除外しません。

私は見たこれしかし、うまくいきません。 Remote/ftp ディレクトリ構造は次のとおりです。

domain.com/
  toplevel/
    foo1/
      ARCHIVE/
        README.stuff
        DATA/
          README.txt
          ...other nested folders
      wantedstuff.zip
      wantedstuff2/
        morewantedstuff.zip
        ...otherstuffwanted

/toplevel.txt/ARCHIVE内の各入れ子になったフォルダのフォルダ内のすべてを除くすべてが欲しいです/toplevel/*

私はこれを試しました:

wget --continue -r --exclude-directories=/ARCHIVE/ ftp://domain.com/toplevel/

そしてこれらは:

wget --continue -r --exclude-directories=ARCHIVE ftp://domain.com/toplevel/
wget --continue -r --exclude-directories=ARCHIVE/ ftp://domain.com/toplevel/
wget --continue -r X /ARCHIVE/ ftp://domain.com/toplevel/
wget --continue -r -X '*/ARCHIVE/*' ftp://domain.com/toplevel/
wget --continue -r -X '*/ARCHIVE' ftp://domain.com/toplevel/
wget --continue -r --reject-regex '.*/ARCHIVE/.*' ftp://domain.com/toplevel/

しかし、どちらもうまくいかないようです。それでもARCHIVEフォルダをダウンロードしてください。ダウンロードを中止する方法が気になります。

ベストアンサー1

toplevel/foo を含める必要があります。前の例解決策は次のとおりです。

wget --continue -r --exclude-directories=/toplevel/foo/ARCHIVE/ ftp://domain.com/toplevel/

何らかの理由で、私は以下を好みます。

wget --continue  -X /toplevel/foo/ARCHIVE/ -r ftp://domain.com/toplevel/

最初の 2 つの最上位レベルからすべての ARCHIVE ディレクトリを除外するには:

wget --continue  -X */*/ARCHIVE/ -r ftp://domain.com/toplevel/

しかし、これは個人的な好みです。

おすすめ記事