Friday, May 29, 2015

HOW TO - Move all the log files to zip file

q: A customer called today to ask how they could zip all the log files in all the folders and sub-folders into a zip file.

a: Here is the steps we suggested:

  1. Install Izarc 4.1.6 - http://www.filehippo.com/download_izarc/9368/
  2. Install Izarc Command Line - http://www.izarc.org/download/IZArcCL.exe
  3. Add the Izarc folder to the path
  4. Create d:\temp & confirm account running the task has writes to this folder.
  5. IZARCC.exe -m -r -P D:\Download\201505_logs.zip d:\ex*.log -$d:\temp\
  6. This runs the the command line version of Izarc, creates a zip file at the path of d:\download\ filled with all the files on the D drive that start with ex and end with .log and it uses the d:\download folder as the temp folder.  Note that last part is nice, because by default it would create the temp file on the C Drive then have to move it back.
  7. Don't forget, this moves the log files to the Recycle Bin.  Add this to the bottom of the script and it will delete the Recycle Bin before it gets too big.
  8. rd /q /s d:\recycler