Saya ingin tahu apa perintah yang digunakan untuk mem-gunzip semua file dalam direktori target secara rekursif? Saya mencoba menggunakan perintah unzip tetapi tidak berhasil.
Saya mencoba perintah dari Unzip semua file zip di folder target?
Saya ingin tahu apa perintah yang digunakan untuk mem-gunzip semua file dalam direktori target secara rekursif? Saya mencoba menggunakan perintah unzip tetapi tidak berhasil.
Saya mencoba perintah dari Unzip semua file zip di folder target?
Jawaban:
Menggunakan perintah di bawah ini. Ganti <path_of_your_zips>dengan jalur ke file ZIP Anda dan <out>dengan folder tujuan Anda:
Untuk file GZ
find <path_of_your_zips> -type f -name "*.gz" -exec tar xf {} -C <out> \;
atau
find <path_of_your_zips> -type f -name "*.gz" -print0 | xargs -0 -I{} tar xf {} -C <out>
Untuk file ZIP
find <path_of_your_zips> -type f -name "*.zip" -exec unzip {} -d <out> \;
atau
find <path_of_your_zips> -type f -name "*.zip" -print0 | xargs -0 -I{} unzip {} -d <out>
-execsuka find . -type f -name "*.gz" -exec tar xzf {} -C <out> \;?
tar: This does not look like a tar archive
gunzipmemiliki -ropsi. Dari man gunzip:
-r --recursive
Travel the directory structure recursively. If any of the
file names specified on the command line are directories, gzip
will descend into the directory and compress all the files it finds
there (or decompress them in the case of gunzip ).
Jadi, jika Anda ingin gunzipsemua file terkompresi ( gunzipsaat ini dapat mendekompres file yang dibuat oleh gzip, zip, kompres, kompres -H atau paket) di dalam direktori /foo/bardan semua subdirektori:
gunzip -r /foo/bar
Ini akan menangani nama file dengan spasi juga.