Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Rotate File with Date Stamp and Zip

$
0
0

Hey Guys

New to powershell.. Just want to write a simple script to do the following. The file is called D:\test.log

1) Rotate it every night at 12pm (I guess schedule via task manager)

2) Rename it to YYYY-MM-DD-filename.log at that time. Create a new file called test.log so current logging can continue (or just keeps running on that file after rename of file)

3) Zip it. and leave it there..

Can anyone help on how to do so? And also if I want to expand this script to do multiple files (but same rotated file format), that would be helpful (I guess some for each statement ? )

Will run on Windows 2008 R2 Servers..

Appreciate your help!!!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>