定期的にフォルダを圧縮します。その際、大きなサイズのファイルやショートカットを除外します。
実行には7zipコマンドライン版を使用しています。(のちに運用でパスワードを付けるため。)
しかし、ファイル単位の除外がうまくいきません。任意のファイルを除外するコマンドを教えて下さい。
試したのは以下のとおりです。
python
1archive_cmd = 'C:\bk\7za.exe a -ssw -mx=1 ' 2for ex in ex_words: 3 archive_cmd += ' "-xr0!' + ex + '" ' 4for ex in ex_files: 5 archive_cmd += ' "-xr' + ex + '" ' 6archive_cmd += ' "' + outfile + '" ' 7archive_cmd += ' "' + targetfolder + '" '
たぶん以下の通り出力されています。
script
1C:\bk\7za.exe a -ssw -mx=1 "-xr0!*.lnk" "-xr!C:\temp\data\big data.x64.iso" "C:\bk\bk001.zip" "C:\temp"
ちなみに、**"-xr!C:\temp\data\big data.x64.iso" **に相当する部分を以下の通り試しましたが、できませんでした。
- "-x!C:\temp\data\big data.x64.iso" -> 除外されない
- -x!"C:\temp\data\big data.x64.iso" -> 除外されない
- "-xr!C:\temp\data\big data.x64.iso" -> 除外されない
- "-xrC:\temp\data\big data.x64.iso" -> Command line error:Incorrect wild card type marker
- "-xtemp\data\big data.x64.iso" -> Command line error:Incorrect wild card type marker
あなたの回答
tips
プレビュー