Skip to content

Commit d6ca599

Browse files
Merge pull request geekcomputers#92 from Henocks/patch-7
Update script_listing.py
2 parents acb6ecb + 9d43f40 commit d6ca599

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

script_listing.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111

1212
import os # Load the library module
1313

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
1515
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
1721

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
2122
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
2324
log.write(os.path.join(dirpath, filename)+'\n') # Write the full path out to the logfile
24-
print "\nYour logfile " , logfilename, "has been created" # Small message informing the user the file has been created
25+
26+
print ("\nYour logfile " , logfilename, "has been created") # Small message informing the user the file has been created

0 commit comments

Comments
 (0)