I have a directory that I have been storing a lot of files so I'm working on a script to watch the disk space if it gets more than 80% then it will compress the files.
all the files end with file.# my question is how to zip all files that end with a number without zipping the zipped files
I did the most of the script but I'm stuck with at this point
please your help
You can zip the files that are outputted by this command find. -not -name "*.zip"
find. -not -name "*.zip"
.
Find is a command that is used well, to "find" files based on various criteria.
You can read more about it using man find
or (online version) here
Simply run the zip
command with -x
argument to exclude already zipped files from being added to the compressed archive. The command will look like:
zip -r compressed.zip . -x "*.zip"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.