Link to home
Start Free TrialLog in
Avatar of andieje
andieje

asked on

How would i gzip every direcory within a directory and then list its size

Hi

Lets say i have my top level directory and these have subdirectories called dir1, dir2, dir3 etc. These subdirectories can in turn have subdirectories.

I would like a command which will gzip every directory in my current working directory. I am hoping this will zip any subdirectories therein. The name of the zipped top level directory can simply be the name of the original directory appended with .gz

I've seen this but this will zip and the directories and create a tar acrhive?
tar czvf mytar.tar.gz dir1 dir2 .. dirN

What if i just want to gzip the files and not create the tar file?
SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

gzip only works on individual files.

If you want to create a compressed archive of directories and multiple files, then you need to either tar/compress, or use zip.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Surrano,

Thanks for catching that.  I typed those after a 12 hour work day doing an "after hours" server upgrade/transition.
Avatar of andieje

ASKER

wonderfuol