Changeset 25 for tools/pytools/diskreport.py
- Timestamp:
- Nov 18, 2004, 11:43:50 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/pytools/diskreport.py
r24 r25 40 40 41 41 try: 42 x = float(fields[ col])42 x = float(fields[4]) 43 43 except: 44 44 pass 45 print fields 45 46 else: 46 47 sizes.append(x) 47 48 A.append( fields ) 48 49 49 50 S = map(None, sizes, A) 51 50 # Schwartzian transform 51 S = [ (sizes[i], A[i]) for i in range(len(sizes)) ] #List comprehension 52 52 S.sort() 53 54 B = map(lambda x: x[1], A) 55 56 print B 53 B = [x[1] for x in S] 54 55 print A, B 56 57 58 return B 57 59 58 60 … … 75 77 print 'DISKREPORT FOR DIRECTORY %s' %dir 76 78 77 78 79 # Find the largest directories 79 cmd = 'du -k %s| sort -nr > %s' %(dir, tempfile)80 cmd = 'du -k "%s" | sort -nr > %s' %(dir, tempfile) 80 81 #print cmd 81 82 os.system(cmd) … … 85 86 fid.close() 86 87 87 txt = 'Top 50 largest directories '88 txt = 'Top 50 largest directories on %s (stated in kilo bytes)' %dir 88 89 os.system('echo "%s" > top50.txt' %txt) 89 90 … … 118 119 l = line.strip() 119 120 oldfiles.append(l) 121 #Use python os to get stats 122 #Or use: find <path> -name <name> -type f -atime +30 -exec ls -all {} \; 123 #find $1 -type f -size +2048 -xdev -exec ls -s {} + | /bin/sort -nr 124 #find / -xdev -size +1024 -exec ls -al {} \; | sort -r -k 5 125 126 #GREAT ONE 127 #find . -type f -size +10 -printf "%s %u %a %k %h%f \n" | sort -nr 128 129 print os.stat(l) 120 130 cmd = 'ls -lua "%s" >> oldfiles.txt 2>/dev/null' %l 121 131 #print cmd
Note: See TracChangeset
for help on using the changeset viewer.