Power of Linux Find command

Today, I have come across with the situation to back up all JSP files inside a folder in Linux system.  Following command in Linux came as handy


find . -name "*.jsp" -exec zip jspzip.zip {} +

The -exec option takes a command, here we need to pass “zip” command. The {}+ means that all files found by find command will be send to the zip command. There is a variation of this command and it is like below,

 find . -name "*.jsp" -exec zip jspzip.zip {} ; 

The above command will send files to zip command one by one and thus it takes lot of time
zip about 600 + files in a folder.

Leave a Reply

Your email address will not be published.

WP2Social Auto Publish Powered By : XYZScripts.com