various log files older than 5 weeks need zipping up (7 zip is installed on server) - help would be appreciated

Hi,

I've been asked to zip up some logs on various servers that are taking up quite a bit of space, these logs need to only be zipped, they don't need to be moved, ideally the logs will be zipped using their original file name and individually, but if the script was to be run monthly/weekly then the resulting 7z file could contain the previous month / week etc. The business would only like files that are older than 5 weeks to be zipped (so anything newer would be untouched).

I unfortunately have no scripting experience so I'm a little bit lost. We have 7 zip installed on the servers and I know it can be used from the command line (7z?)

the log files are called -

<server name>.ccxml<DDMMYY>.log

<server name>.act<DDMMYY>.log

<server name>cdr<DDMMYY>.log

annoyingly the 'cdr' log has no '.' after the server name.

I'm sure the above is easy to someone with scripting knowledge and I'd appreciate any advice/help with this

thanks

July 2nd, 2013 7:19am

ZIpping up a file is easy - and you don't need 7zip as long as you have .NET 4.5.

See http://pshscripts.blogspot.co.uk/2013_02_01_archive.html for an example of how to zip up files using .NET and PowerShell.

Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2013 9:53am

You can also just use command line switches to do this with 7Zip.  See the help files for examples of using templates for file names.

July 2nd, 2013 12:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics