@@ -71,7 +71,7 @@ def version():
7171 """Print version, license and exit"""
7272 if args .version :
7373 print (
74- """lsi version 1.1.0
74+ """lsi version 1.1.1
7575
7676Copyright (c) 2017 js-d-coder (www.github.com/js-d-coder)
7777
@@ -100,34 +100,25 @@ THE SOFTWARE.
100100
101101def createFileList (dirname ):
102102 """create list of files in given directory based on various options"""
103- dirContents = []
104- all = os .listdir (dirname )
103+ files = []
104+ dirs = []
105+ all_files = os .listdir (dirname )
106+
105107 if args .non_hidden :
106- if args .only_files :
107- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
108- elif args .only_dir :
109- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
110- else :
111- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
112- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
108+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
109+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file ) and file [0 ] != '.' ]
113110 elif args .hidden :
114- if args .only_files :
115- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
116- elif args .only_dir :
117- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
118- else :
119- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
120- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
111+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
112+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file ) and file [0 ] == '.' ]
121113 else :
122- if args .only_files :
123- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file )]
124- elif args .only_dir :
125- dirContents = [file + "/" for file in all if os .path .isdir (dirname + "/" + file )]
126- else :
127- dirContents = [file for file in all if not os .path .isdir (dirname + "/" + file )]
128- dirContents += [file + "/" for file in all if os .path .isdir (dirname + "/" + file )]
129- return dirContents
130-
114+ files = [file for file in all_files if not os .path .isdir (dirname + "/" + file )]
115+ dirs = [file + "/" for file in all_files if os .path .isdir (dirname + "/" + file )]
116+ if args .only_files :
117+ return files
118+ elif args .only_dir :
119+ return dirs
120+ else :
121+ return files + dirs
131122
132123def xargsInput ():
133124 """create string of null terminated file names for processing by xargs command"""
0 commit comments