Back to SDS/2 Parametric Scripts

 

### Return and print a sorted file list from a given directory

import os, time

 

dir_name = (os.path.join('C:/', 'SDS2_7.0', 'macro'))

 

def dirlist_sorted(dir_name):

   

    # Get a list of full pathnames for all the files in dir_name

    # and exclude all the subdirectories.

    files=[os.path.join(dir_name, x) for x in os.listdir(dir_name)

           if not os.path.isdir(os.path.join(dir_name, x))]

 

    # Make a list of tuples that contain (mtime, filename) for sorting

    flist=[(os.stat(x).st_mtime, x) for x in files]

 

    flist.sort()

   

    # Return a list of file names and times of last modification

    return [(x[1], x[0]) for x in flist]

 

iter = dirlist_sorted(dir_name)

s = []

 

for name, stat in iter:

    s.append('%-60s  Last modified: %s @ %s\n' % (name, time.strftime("%a %b %d %Y",time.localtime(stat)),\

                                             time.strftime("%H:%M:%S",time.localtime(stat))))

print "".join(s)

   

"""

>>> C:/SDS2_7.0\macro\V7Hip_Roof_Geometry_R2.py                   Last modified: Tue Sep 14 2004 @ 06:52:04

C:/SDS2_7.0\macro\DD-TubeBeamCap.py                           Last modified: Mon Oct 25 2004 @ 20:14:30

C:/SDS2_7.0\macro\V7Misc_RolledEdge_R2.py                     Last modified: Wed Oct 26 2005 @ 05:02:19

C:/SDS2_7.0\macro\V7Beam_RolledEdge_R2.py                     Last modified: Wed Oct 26 2005 @ 05:03:06

C:/SDS2_7.0\macro\V7Beam_HipPlate_R2.py                       Last modified: Thu Feb 16 2006 @ 08:50:39

C:/SDS2_7.0\macro\V7Beam_Cap_Channel_R2.py                    Last modified: Thu Feb 16 2006 @ 08:51:18

C:/SDS2_7.0\macro\V7Beam_RidgePlate_R2.py                     Last modified: Thu Feb 16 2006 @ 09:12:59

C:/SDS2_7.0\macro\V7Col_BntPLConn_R3.py                       Last modified: Thu Feb 16 2006 @ 09:15:45

C:/SDS2_7.0\macro\V7Col_SafetyHolesMark_R2.py                 Last modified: Thu Feb 16 2006 @ 09:17:59

C:/SDS2_7.0\macro\V7Col_WebChanBolted_R2.py                   Last modified: Thu Feb 16 2006 @ 09:20:47

C:/SDS2_7.0\macro\V7Col_WebSpliceShims_R2.py                  Last modified: Thu Feb 16 2006 @ 09:21:46

C:/SDS2_7.0\macro\V7Girt_SagRodHoles_R2.py                    Last modified: Tue Apr 04 2006 @ 12:38:54

C:/SDS2_7.0\macro\V7Beam_SagRodHoles_R2.py                    Last modified: Tue Apr 04 2006 @ 12:46:05

C:/SDS2_7.0\macro\Beam_Flg_Prep_Outside_v1.01.py              Last modified: Mon Apr 10 2006 @ 12:41:30

C:/SDS2_7.0\macro\Embed_Angle_v1.03.py                        Last modified: Mon Apr 10 2006 @ 12:53:20

C:/SDS2_7.0\macro\V7Col_TopGirtClip_R3.py                     Last modified: Wed Apr 12 2006 @ 20:55:49

C:/SDS2_7.0\macro\Beam_ShearTab_v1.00.py                      Last modified: Sun Apr 16 2006 @ 12:36:43

C:/SDS2_7.0\macro\600-Outrigger_under_L4.py                   Last modified: Mon May 08 2006 @ 08:01:29

C:/SDS2_7.0\macro\600-Outrigger_15S3_01.py                    Last modified: Mon May 08 2006 @ 17:01:39

C:/SDS2_7.0\macro\Beam_RolledShapeOutrigger_v1.01.py          Last modified: Wed May 10 2006 @ 18:24:04

C:/SDS2_7.0\macro\600-Col_SafetyHoles.py                      Last modified: Wed May 10 2006 @ 19:28:58

C:/SDS2_7.0\macro\Col_SafetyHoles_v1.05.py                    Last modified: Thu May 11 2006 @ 05:48:38

C:/SDS2_7.0\macro\Opening_Frame_R8.py                         Last modified: Sun Jun 11 2006 @ 20:56:28

C:/SDS2_7.0\macro\V7Member_Count_R3.py                        Last modified: Fri Jun 16 2006 @ 10:12:41

C:/SDS2_7.0\macro\Col_Flg_Prep_Outside_v1.02.py               Last modified: Tue Aug 08 2006 @ 19:37:54

C:/SDS2_7.0\macro\Beam_Clips_v1.06.py                         Last modified: Mon Aug 14 2006 @ 10:38:48

C:/SDS2_7.0\macro\Beam_Cap_Channel_v1.00.py                   Last modified: Wed Aug 16 2006 @ 19:36:02

C:/SDS2_7.0\macro\Col_ErectSeat_R8.py                         Last modified: Tue Aug 22 2006 @ 11:36:23

C:/SDS2_7.0\macro\600-SS_BentPl.py                            Last modified: Wed Aug 23 2006 @ 09:41:15

C:/SDS2_7.0\macro\Member_803.pdf                              Last modified: Fri Aug 25 2006 @ 14:19:05

C:/SDS2_7.0\macro\Beam_Flg_Prep_Field_v1.01.py                Last modified: Sat Aug 26 2006 @ 06:49:06

C:/SDS2_7.0\macro\605-SS_BentPl.py                            Last modified: Sun Aug 27 2006 @ 20:19:48

C:/SDS2_7.0\macro\Beam_OutriggerPL_1.01.py                    Last modified: Sat Sep 30 2006 @ 20:59:56

C:/SDS2_7.0\macro\Beam_Edge_Angle_v1.00.py                    Last modified: Sat Sep 30 2006 @ 21:15:31

C:/SDS2_7.0\macro\Const_Point_Array.py                        Last modified: Thu Oct 05 2006 @ 22:00:51

C:/SDS2_7.0\macro\B-E2.pdf                                    Last modified: Sat Oct 07 2006 @ 10:46:31

C:/SDS2_7.0\macro\DefaultsPickleVar.txt                       Last modified: Thu Nov 02 2006 @ 09:04:06

C:/SDS2_7.0\macro\PrintLocals.txt                             Last modified: Sat Nov 04 2006 @ 09:46:20

C:/SDS2_7.0\macro\BeamHSSFill.txt                             Last modified: Sat Nov 04 2006 @ 09:47:23

C:/SDS2_7.0\macro\BeamAngleFill.txt                           Last modified: Sat Nov 04 2006 @ 09:48:03

C:/SDS2_7.0\macro\BeamWFFill.txt                              Last modified: Sat Nov 04 2006 @ 09:48:28

C:/SDS2_7.0\macro\PrintDict.txt                               Last modified: Sun Nov 05 2006 @ 10:52:45

C:/SDS2_7.0\macro\L3D.txt                                     Last modified: Mon Nov 06 2006 @ 06:33:19

C:/SDS2_7.0\macro\read_me_first.txt                           Last modified: Wed Nov 08 2006 @ 10:15:56

C:/SDS2_7.0\macro\V7MemberPropertiesMisc_R2.py                Last modified: Sat Nov 11 2006 @ 21:41:05

C:/SDS2_7.0\macro\EllipseLayout.txt                           Last modified: Sun Nov 12 2006 @ 09:10:15

C:/SDS2_7.0\macro\Plane3PConsCircle3D.txt                     Last modified: Sun Nov 12 2006 @ 09:31:33

C:/SDS2_7.0\macro\PlaneConstArray3D.txt                       Last modified: Sun Nov 12 2006 @ 09:42:17

C:/SDS2_7.0\macro\PlaneConstSpacing3D.txt                     Last modified: Sun Nov 12 2006 @ 09:46:41

C:/SDS2_7.0\macro\angle.txt                                   Last modified: Sun Nov 12 2006 @ 11:16:47

C:/SDS2_7.0\macro\PrintPtList.txt                             Last modified: Wed Nov 15 2006 @ 09:46:15

C:/SDS2_7.0\macro\Basis3D.txt                                 Last modified: Wed Nov 15 2006 @ 14:25:03

C:/SDS2_7.0\macro\Rotate_About_Axis.txt                       Last modified: Wed Nov 15 2006 @ 22:39:13

C:/SDS2_7.0\macro\P3D.txt                                     Last modified: Thu Nov 16 2006 @ 06:55:46

C:/SDS2_7.0\macro\PointRotate.txt                             Last modified: Thu Nov 16 2006 @ 07:02:21

C:/SDS2_7.0\macro\ColumnFraming.txt                           Last modified: Tue Nov 21 2006 @ 09:41:34

C:/SDS2_7.0\macro\SpliceFraming.txt                           Last modified: Tue Nov 21 2006 @ 10:26:48

C:/SDS2_7.0\macro\BeamFraming.txt                             Last modified: Tue Nov 21 2006 @ 10:28:26

C:/SDS2_7.0\macro\FileDefaults.txt                            Last modified: Tue Nov 21 2006 @ 10:35:00

C:/SDS2_7.0\macro\MemCnt.txt                                  Last modified: Tue Nov 21 2006 @ 10:38:45

C:/SDS2_7.0\macro\BeamBPLPourstop.txt                         Last modified: Wed Nov 22 2006 @ 14:03:19

C:/SDS2_7.0\macro\__init__.py                                 Last modified: Wed Nov 22 2006 @ 19:33:15

C:/SDS2_7.0\macro\dirlist.txt                                 Last modified: Wed Nov 22 2006 @ 21:20:48

C:/SDS2_7.0\macro\BeamStiff.txt                               Last modified: Tue Dec 05 2006 @ 09:49:41

C:/SDS2_7.0\macro\V7Beam_MomentClip_R1.py                     Last modified: Thu Dec 07 2006 @ 11:08:21

C:/SDS2_7.0\macro\MomentClip.jpg                              Last modified: Thu Dec 07 2006 @ 11:11:16

C:/SDS2_7.0\macro\MomentClip.pdf                              Last modified: Thu Dec 07 2006 @ 11:12:55

C:/SDS2_7.0\macro\Marla121206.zip                             Last modified: Tue Dec 12 2006 @ 16:46:13

C:/SDS2_7.0\macro\Beam_NailerHoles_v1.05.py                   Last modified: Tue Dec 12 2006 @ 16:53:14

C:/SDS2_7.0\macro\metaclasses-pycon.pdf                       Last modified: Sat Dec 16 2006 @ 09:33:05

C:/SDS2_7.0\macro\Python_Performance.txt                      Last modified: Mon Dec 18 2006 @ 08:42:02

C:/SDS2_7.0\macro\Beam_Flg_Prep_Field_v1.02.py                Last modified: Mon Dec 18 2006 @ 19:10:08

C:/SDS2_7.0\macro\Embed_Plate_v1.06.py                        Last modified: Tue Dec 26 2006 @ 13:59:52

C:/SDS2_7.0\macro\Basis3D_Post.txt                            Last modified: Wed Dec 27 2006 @ 13:28:56

C:/SDS2_7.0\macro\Basis3D_Post2.txt                           Last modified: Wed Dec 27 2006 @ 18:24:40

C:/SDS2_7.0\macro\V7Misc_SS_R1.py                             Last modified: Fri Jan 12 2007 @ 13:17:58

C:/SDS2_7.0\macro\Col_RFStiff_v1.00.py                        Last modified: Wed Jan 17 2007 @ 09:26:57

C:/SDS2_7.0\macro\PlaneConstArray3D.jpg                       Last modified: Fri Jan 19 2007 @ 11:59:34

C:/SDS2_7.0\macro\Thumbs.db                                   Last modified: Wed Jan 24 2007 @ 11:28:03

C:/SDS2_7.0\macro\Plate_radius_cut.jpg                        Last modified: Wed Jan 24 2007 @ 13:31:40

C:/SDS2_7.0\macro\Plate_radiushole_cut.jpg                    Last modified: Wed Jan 24 2007 @ 14:08:21

C:/SDS2_7.0\macro\Beam_NailerHoles_v1.06.py                   Last modified: Thu Jan 25 2007 @ 13:52:49

C:/SDS2_7.0\macro\DefaultsBeam_NailerHoles.txt                Last modified: Thu Jan 25 2007 @ 14:01:30

C:/SDS2_7.0\macro\Beam_NailerHoles_v1.07.py                   Last modified: Thu Jan 25 2007 @ 14:06:02

C:/SDS2_7.0\macro\HoleArray1-CounterClockwise.gif             Last modified: Thu Jan 25 2007 @ 21:59:02

C:/SDS2_7.0\macro\HoleArray2-Clockwise.gif                    Last modified: Thu Jan 25 2007 @ 22:00:42

C:/SDS2_7.0\macro\HoleArray3-Clockwise.gif                    Last modified: Thu Jan 25 2007 @ 22:02:54

C:/SDS2_7.0\macro\HoleArray4-Clockwise.gif                    Last modified: Thu Jan 25 2007 @ 22:11:00

C:/SDS2_7.0\macro\ConsCircle3Point.gif                        Last modified: Thu Jan 25 2007 @ 22:37:36

C:/SDS2_7.0\macro\__init__.pyc                                Last modified: Thu Feb 08 2007 @ 15:26:41

C:/SDS2_7.0\macro\V7Col_WebWeldThru_R2.py                     Last modified: Fri Feb 09 2007 @ 08:43:21

C:/SDS2_7.0\macro\Beam_Flg_Prep_Field_v1.xx.py                Last modified: Fri Feb 09 2007 @ 09:32:47

C:/SDS2_7.0\macro\Beam_KickerGPL_v1.07.py                     Last modified: Fri Feb 09 2007 @ 22:00:35

C:/SDS2_7.0\macro\Mtrl_Flg_Prep_Field_v1.00.py                Last modified: Wed Feb 14 2007 @ 10:38:54

C:/SDS2_7.0\macro\Beam_Flg_Prep_Field_v1.03.py                Last modified: Wed Feb 14 2007 @ 10:40:06

>>> """