powershell script to archive files in many subfolders -
i trying write down script can me archive multiple files in multiple subdirs. need exclude specific files. far got few lines script
$files = get-childitem -recurse -path "d:\path\to\folder" -exclude *i.jpeg | where-object { $_.fullname -notmatch '\\excludedir($|\\)' } foreach ($file in $files) { c:\program files\7-zip\7z.exe" -t7z -mx=9 -ms=on $file } basically searches recursively subfolders .jpeg files , gives me list of them excluding ones ends 'i'.jpeg lets 'photoi.jpeg'. working, cannot make next step need run 7zip listed files.
can me out here. in advance :)
not sure if trying save 1 big zip lots of individual ones, this:
set-alias sz "c:\program files\7-zip\7z.exe" $files = get-childitem -recurse -path "d:\path\to\folder" -exclude *i.jpeg | where-object { $_.fullname -notmatch '\\excludedir($|\\)' } foreach ($file in $files) { $output = sz -t7z -mx=9 -ms=on "$file" 2>&1 } you might have modify zipping line has have tested using command line options. nice touch have captured output of command reporting purposes.
Comments
Post a Comment