0
0

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 1 year has passed since last update.

zipコマンドでzipファイルは生成されるが展開できない場合

Last updated at Posted at 2023-11-01

起きたこと

シェル作っている中で、特定のフォルダをzipにする必要があった。
このように、1つ前の階層にある他のフォルダにあるフォルダに対して圧縮しようとした。

zip -r ../tmp_oracledb_setup/LINUX.X64_193000_db_home.zip ../tmp_oracledb_setup/LINUX.X64_193000_db_home

大きなシェルを作っているので、zip自体は作れているからバグに気づくのに少し時間がかかった。
Oracle関連でいろいろエラーが出ていてなんでだろと思って手動で生成されたファイルを展開しようとしたら、できない。。。

image.png

解決方法

調べたら、違うディレクトリのパスを指定してやるとうまくいかなくなることがあるらしい。
cdコマンドで移動してから「../」とかつけずにやったらちゃんと展開できるzipファイルが生成された。

now_dir=$(pwd)

cd ../tmp_oracledb_setup/
zip -r LINUX.X64_193000_db_home.zip LINUX.X64_193000_db_home

cd $now_dir
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?