Skip to content

Commit 57f7f0a

Browse files
author
Jared Manning
committed
Tidy up comments and syntax
1 parent 83432b9 commit 57f7f0a

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

logs.py

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
# Script Name : logs.py
2-
# Author : Craig Richards
3-
# Created : 13th October 2011
4-
# Last Modified :
5-
# Version : 1.1
6-
# 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.
1+
# Script Name : logs.py
2+
# Author : Craig Richards
3+
# Created : 13th October 2011
4+
# Last Modified : 14 February 2016
5+
# Version : 1.2
6+
#
7+
# 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.
8+
# : 1.2 - Tidy up comments and syntax
9+
#
10+
# 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
711

8-
# 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
12+
import os # Load the Library Module
13+
from time import strftime # Load just the strftime Module from Time
914

10-
import os # Load the Library Module
11-
from time import strftime # Load just the strftime Module from Time
15+
logsdir="c:\puttylogs" # Set the Variable logsdir
16+
zip_program="zip.exe" # Set the Variable zip_program - 1.1
1217

13-
logsdir="c:\puttylogs" # Set the Variable logsdir
14-
zip_program="zip.exe" # Set the Variable zip_program - 1.1
15-
16-
for files in os.listdir(logsdir): # Find all the files in the directory
17-
if files.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
21-
os.remove(files) # Remove the original log files
18+
for files in os.listdir(logsdir): # Find all the files in the directory
19+
if files.endswith(".log"): # Check to ensure the files in the directory end in .log
20+
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
21+
os.chdir(logsdir) # Change directory to the logsdir
22+
os.system(zip_program + " " + files1 +" "+ files) # Zip the logs into dated zip files for each server. - 1.1
23+
os.remove(files) # Remove the original log files

0 commit comments

Comments
 (0)