GIPPER : zip selected files and subdirectories (gipper = grep + zip)
Usage:
files = gipper (directory, include, exclude, exclude_hidden) ;
Creates a zip file of all files and subdirectories in a directory. A file in the directory or any of its subdirectories whose name matches any expression in 'include' via regexp is added to the zip file. A file that matches any expression in 'exclude' is not added. A subdirectory whose name or full pathname matches any expression in 'exclude' is not searched. The name of the zip file is the name of the directory, with '.zip' appended.
Hidden files are excluded by default.
Examples, assuming "X" is the name of the current directory:
% include all files in X (except hidden files) in the zip file ../X.zip
gipper
% create mytoolbox.zip archive of the 'X/mytoolbox' directory
gipper mytoolbox
% only include *.m files in ../X.zip
gipper '' '\.m$'
% create ../X.zip, but exclude compiled object and MEX files
gipper ('', '', { '\.o$' '\.obj$', ['\.' mexext '$'] })
% include everything, including hidden files, in ../X.zip
gipper ('', '', '', 0)
% zip mytoolbox, except hidden files and the mytoolbox/old directory
gipper mytoolbox '' old
% these are the same, except gipper also traverses subdirectories
gipper ('', { '\.m$', '\.*mat$' })
zip ('../X', { '*.m', '*.mat' }) |