find <DIRECTORY_PATH> -name \*<PATTERN>\* | zip <ZIP_FILE_NAME>.zip -@
Showing posts with label zip. Show all posts
Showing posts with label zip. Show all posts
How to zip files with a pattern in name into a single zip file
To zip files with a certain pattern in their name in a directory, we can combine find and zip command like below :
Using md5 checksum to check for integrity of your large uploaded/downloded file
Have you ever downloaded/uploaded a file from/to another computer and wanted to verify the integrity of the file to make sure it is not corrupted. The obvious way is to compare the file size of the original final and the copied file. However there are many ways that this number could mislead you.
Just to give two examples, in some cases the program you use to download/upload the file can fail to fill in all the data and just pad the file to the correct size. Hardware errors such as disk and memory issues can cause corruptions too that won't effect the file size. So how do you make sure your file is not corrupted and check the integrity of your downloaded/uploaded file.
On Linux/Unix you can use md5sum. The way to use it is to simply run :
md5sum [yourfile]
This prints out something like :
16295afa0087ef75f33751cf003da993 [yourfile]
You will need to run the above command on both the origin of the file and it's destination and compare the digital fingerprint of the file printed. For unique files that fingerprint will be the same.
A lot of websites that let users download files ( specially large files which have a higher chance of getting corrupted in transit ) will provide checksums for their files which you can compare against your when you download is done.
Just to give two examples, in some cases the program you use to download/upload the file can fail to fill in all the data and just pad the file to the correct size. Hardware errors such as disk and memory issues can cause corruptions too that won't effect the file size. So how do you make sure your file is not corrupted and check the integrity of your downloaded/uploaded file.
On Linux/Unix you can use md5sum. The way to use it is to simply run :
md5sum [yourfile]
This prints out something like :
16295afa0087ef75f33751cf003da993 [yourfile]
You will need to run the above command on both the origin of the file and it's destination and compare the digital fingerprint of the file printed. For unique files that fingerprint will be the same.
A lot of websites that let users download files ( specially large files which have a higher chance of getting corrupted in transit ) will provide checksums for their files which you can compare against your when you download is done.
How to combine find and zip to compress WebLogic ADR directories
Weblogic Server has an ADR folder containing a sub directory called incident. This directory holds one directory for each incident that happens during an application lifetime.
Each of these individual incident folder can be several Mega Bytes so i use the following to zip them up and delete them. I set it as a cron to run every 5 minutes.
find /MW_HOME/user_projects/domains/my_domain/servers/AdminServer/adr/diag/ofm/apps/myapp/incident -iname "incdir_*" -type d -exec sh -c 'zip -r {}.zip {}' \; -exec rm -rf {} \;
Each of these individual incident folder can be several Mega Bytes so i use the following to zip them up and delete them. I set it as a cron to run every 5 minutes.
find /MW_HOME/user_projects/domains/my_domain/servers/AdminServer/adr/diag/ofm/apps/myapp/incident -iname "incdir_*" -type d -exec sh -c 'zip -r {}.zip {}' \; -exec rm -rf {} \;
Subscribe to:
Posts (Atom)