RE: DIR command output????

Author: Dave Crozier

Posted: 2011-08-11 at 10:37:33

Matt,

If you want to load up recursed directories into a table then use this:

Dave

*******

* Start of Code

*

* Display Files in a Folder within a Table

Clear All

Clear

Public oForm

oForm=Createobject("MyForm",Addbs(Getdir("c:\temp\")),"*.*",.F.)

Define Class MyForm As Form

AllowOutput=.F. && so '?' output goes to screen

Width=_Screen.Width

Height=_Screen.Height-50

Width=1024

Height=798

Procedure Init(cPath As String, cMask As String, fSubDir As Boolean)

Set Exclusive Off

Set Safety Off

Set Talk Off

Set Exact Off

Create Cursor Files (Path c(240),fname c(240),Fsize N(10,0),Timestamp T)

This.DoDir(cPath,cMask)

Index On Timestamp Descending Tag T && choose your desired order

* INDEX on fsize DESCENDING TAG fsize

With This

.AddObject("gr","grid")

With .gr

.AllowCellSelection=.F.

.Visible=1

.Height=Thisform.Height

.Width = Thisform.Width

.AutoFit

.Column3.InputMask="999,999,999"

Endwith

.Show

*

Endwith

Procedure DoDir(cPath As String, cMask As String)

Local N,i,aa[1]

N=Adir(aa,cPath+cMask,"",1)

For i = 1 To N

Insert Into Files (Path,fname,Fsize,Timestamp) Values ;

(cPath, aa[i,1], aa[i,2],Ctot(Dtoc(aa[i,3])+aa[i,4]))

Endfor

N=Adir(aa,cPath+"*.*","HD",1) && now without the mask, search for directories

For i = 1 To N

If "D"$aa[i,5] && if it's a dir

If aa[i,1] != '.'

This.DoDir(cPath+aa[i,1]+"\",cMask) && recur

Endif

Endif

Endfor

Enddefine

*

* End of Code

****************

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of Matt Slay

Sent: 11 August 2011 14:16

To: profoxtech@leafe.com

Subject: DIR command output????

Is there any way to make the output from the DIR command show more

information about the files in the current directory? I would expect to see

output much like the real DOS command where it shows columns of information

that include the filename, date, and file size in a vertical flowing format.

It seems that the DIR command in FoxPro is designed to work with DBF files

be default, and it does show more info about those files.

However, if you use Dir *.*, then what FoxPro spits out is some dorky

sideways list of just file names, without the date and filesize. It's just

really hard to read. What were they thinking?

Has anyone developed a better DIR command for VFP????

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999736289CB@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Dave Crozier