11
11
12
12
import os # Load the library module
13
13
14
- logdir = os .getenv ("logs" ) # Set the variable logdir by getting the value from the OS environment variable logs
14
+ logdir = os .getenv ("logs" ) # Set the variable logdir by getting the value from the OS environment variable logs
15
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
16
+ path = os .getenv ("scripts" ) # Set the varable path by getting the value from the OS environment variable scripts - 1.2
17
+
18
+ #path = (raw_input("Enter dir: ")) # Ask the user for the directory to scan
19
+ logfilename = os .path .join (logdir , logfile ) # Set the variable logfilename by joining logdir and logfile together
20
+ log = open (logfilename , 'w' ) # Set the variable log and open the logfile for writing
17
21
18
- #path = (raw_input("Enter dir: ")) # Ask the user for the directory to scan
19
- logfilename = os .path .join (logdir , logfile ) # Set the variable logfilename by joining logdir and logfile together
20
- log = open (logfilename , 'w' ) # Set the variable log and open the logfile for writing
21
22
for dirpath , dirname , filenames in os .walk (path ): # Go through the directories and the subdirectories
22
- for filename in filenames : # Get all the filenames
23
+ for filename in filenames : # Get all the filenames
23
24
log .write (os .path .join (dirpath , filename )+ '\n ' ) # Write the full path out to the logfile
24
- print "\n Your logfile " , logfilename , "has been created" # Small message informing the user the file has been created
25
+
26
+ print ("\n Your logfile " , logfilename , "has been created" ) # Small message informing the user the file has been created
0 commit comments