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
Copy file name to clipboardExpand all lines: script_listing.py
+6-3
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,21 @@
1
1
# Script Name : script_listing.py
2
2
# Author : Craig Richards
3
3
# Created : 15th February 2012
4
-
# Last Modified :
5
-
# Version : 1.1
4
+
# Last Modified : 29th May 2012
5
+
# Version : 1.2
6
+
6
7
# Modifications : 1.1 - 28-02-2012 - CR - Added the variable to get the logs directory, I then joined the output so the file goes to the logs directory
8
+
# : 1.2 - 29-05/2012 - CR - Changed the line so it doesn't ask for a directory, it now uses the environment varaible scripts
7
9
8
10
# Description : This will list all the files in the given directory, it will also go through all the subdirectories as well
9
11
10
12
importos# Load the library module
11
13
12
14
logdir=os.getenv("logs") # Set the variable logdir by getting the value from the OS environment variable logs
13
15
logfile='script_list.log'# Set the variable logfile
16
+
path=os.getenv("scripts") # Set the varable path by getting the value from the OS environment variable scripts - 1.2
14
17
15
-
path= (raw_input("Enter dir: ")) # Ask the user for the directory to scan
18
+
#path = (raw_input("Enter dir: ")) # Ask the user for the directory to scan
16
19
logfilename=os.path.join(logdir, logfile) # Set the variable logfilename by joining logdir and logfile together
17
20
log=open(logfilename, 'w') # Set the variable log and open the logfile for writing
18
21
fordirpath, dirname, filenamesinos.walk(path): # Go through the directories and the subdirectories
0 commit comments