0

WindowsOSの無効なパスを含む1つのファイルを解凍する必要があります。

9f96bc3dE8d94fc2B1fd2ff9ed8d2637 \ html\ポートレット\facilit\ planooperativo \ themes \ plano-operativo-theme \ css \ data:image

data:image、Windowsでは、パスに:が含まれるディレクトリにすることは許可されていません。解凍するコードでこの例外が発生しましたjava.io.IOException:ファイル名、ディレクトリ名、またはボリュームラベルの構文が正しくありません

どうすれば修正できますか?:を別の文字(たとえば下線)に変更するか、このディレクトリをスキップします。

以下のコードを試しましたが、機能しません。

while (ze != null) {
    String fileName = ze.getName();
    File newFile = new File(outputFolder + File.separator + fileName);

    String nameFile = newFile.getAbsolutePath();
    if (nameFile.contains(":")){
        nameFile.replaceAll(":", "_");
        newFile = new File(nameFile);
    }

実際、私のパスには:が含まれている必要があります。完全なパスはC:\で始まる必要があるため、1つの解決策を教えてください(詳細:Macでは正常に機能します)

4

1 に答える 1

1
 while (ze != null) {
                String fileName = ze.getName();

                if (fileName.contains(":")){
                    fileName = fileName.replaceAll(":", "_");

                }
于 2013-02-07T19:23:39.463 に答える