home *** CD-ROM | disk | FTP | other *** search
-
- (* Summary: This package provides examples of utilities for
- working with external files. The function browse[n]
- generates a table of the files and subdirectories to depth n
- starting with the current directory. *)
-
-
- filedepth[name_String] := Length[StringPosition[name,"/"]]
-
- direxpand[deep_] := With[{toodeep=deep},
- (dir_String/;(FileType[dir]===Directory
- && (#>0 && #<toodeep)&[filedepth[dir]])
- :>{dir/.nameshrink,FileNames["*",dir]})]
-
- nameshrink = (name_String /; filedepth[name] > 0 :>
- StringTake[name,{Last[Flatten[StringPosition[name,"/"]]]+1,-1}])
-
- browse[depth_] := TableForm[{Directory[]//.direxpand[filedepth[Directory[]]
- +depth]
- //.nameshrink},
- TableAlignments->Table[Top,{2depth+3}]]
-
-