You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Description : This script will search for all *.log files in the given directory, zip them using the program you specify and then date stamp them
7
+
8
+
# Modifications : 1.1 - Added the variable zip_program so you can set it for the zip program on whichever OS, so to run on a different OS just change the locations of these two variables.
9
+
10
+
importos# Load the Library Module
11
+
fromtimeimportstrftime# Load just the strftime Module from Time
12
+
13
+
logsdir="c:\puttylogs"# Set the Variable logsdir
14
+
zip_program="zip.exe"# Set the Variable zip_program - 1.1
15
+
16
+
forfilesinos.listdir(logsdir): # Find all the files in the directory
17
+
iffiles.endswith(".log"): # Check to ensure the files in the directory end in .log
18
+
files1=files+"."+strftime("%Y-%m-%d")+".zip"# Create the Variable files1, this is the files in the directory, then we add a suffix with the date and the zip extension
19
+
os.chdir(logsdir) # Change directory to the logsdir
20
+
os.system(zip_program+" "+files1+" "+files) # Zip the logs into dated zip files for each server. - 1.1
0 commit comments