1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数まとめてD&Dされたファイルやディレクトリをそれぞれ別の7zに圧縮するbatファイル

Last updated at Posted at 2015-06-30

過去のプロジェクトのディレクトリとその中身のファイル群、もう使わないかもしれないけど残しておきたいってこと、ありますよね。
そういう場合って正直もう二度と使わないことのほうが大半だとは思うんですけど、それでも残しておきたい。
そんな時に使うbatファイルです。

動作するためにはこのバッチファイルと同じ場所に7zipのexeが必要です。
私はx64用コマンドライン版7zip 15.05 betaにて使用しています。

バグが出るほど難しいことはしていないので大丈夫だとは思いますが、このスクリプトを用いたことによるいかなるデータの損失も僕は補償しかねますので予めご了承ください。

archive.bat
@echo off

cd /d %~dp0

for %%f in (%*) do (
  7za.exe a -t7z -mx=9 %%f.7z %%f
  cls
  rmdir /s /q %%f
)

以下を参考にさせていただきました、ありがとうございます。

7zip Command Line Syntax
http://sevenzip.osdn.jp/chm/cmdline/syntax.htm

【Windows】バッチファイルのコマンドライン引数
http://qiita.com/bokkuri_orz/items/9c9c93fae56cc8653988

[Windows][バッチファイル]カレントディレクトリをバッチファイルのディレクトリにする
http://d.hatena.ne.jp/nakamura001/20090203/1233652705

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?