Reputation: 167
Searching I noticed that it was possible to compress several files individually by gzip. Unfortunately this format is not useful to me.
I tried to compose with the following command.
Find. -type f -name "* .txt" -exec 7z {} \;
Suggestions?
Upvotes: 0
Views: 2204
Reputation: 5335
To add a file to archive, you should use "a" command: 7z a archive.7z file
. So your command should be like this:
find . -type f -name "*.txt" -exec 7z a $(basename {}).7z {} \;
or, if you want archive names like ".txt.7z",
find . -type f -name "*.txt" -exec 7z a {}.7z {} \;
basename
here is to get your file name without extension.
Upvotes: 1