Batch zip files

One of my hard drives is down to its final terabyte, of 8, so its time for me to compress some files. Since I have thousands of files on that drive, it would be inefficient to select them one by one. It turns out its easy to pass a bunch of files to gzip. I relied on the code at this blog. My modified solution:

/usr/bin/find <path/to/directory/with/tweets/>*.txt -mtime +100 -exec gzip {} \; &

This code finds files ending in .txt that are older than 100 days. It then gzips them. The ampersand makes it run in the background.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.