Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fdate(not working)
Message
De
28/02/2016 19:22:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01632238
Message ID:
01632268
Vues:
59
you want to recurse into subfolders from a main folder to list some files given by extension (ex; dbf)
*can be dbf or any file extension to list
*the cursor lists filename,size (octets) ,last date modified,time last modified

local m.yrep,m.lnstart
m.yrep=addbs(getdir())
if empty(m.yrep)
return
endi
publi m.nrep
m.nrep=0

m.ltStart = datetime()
create cursor tempfiles ( cdir c(100),cFilename c(100), nSize n(10), dMod d ,tMod c(10))
RecurseFolder(m.yrep )
messagebox(trans(reccount())+" files   "+trans( datetime() - m.ltStart)+" sec répertoires="+trans(m.nrep),0+32+4096)

index on nSize tag nSize
browse nowait

function RecurseFolder( lcDir )
local i,n, laFiles[1]
m.nrep=m.nrep+1
n = adir( laFiles, lcDir + "*.*", "shd" )
for i = 1 to n
   if ( left( laFiles[i,1], 1 ) != '.' )
      if ( "D" $ laFiles[i,5] )
         RecurseFolder( lcDir + laFiles[i,1] + "\" )
      else
      if  lower(justext(laFiles[i,1])) $ "bmpjpggifpngtiffemf"     &&here images only can be  "dbf'" for ex
        insert into tempfiles values( lcDir , laFiles[i,1], laFiles[i,2], laFiles[i,3] ,laFiles[i,4] )
        endi
      endif
   endif
endfor
return
this is a snippet to work with scripting to return file dates.(cut the space between brackets before run the code)
 local m.lcfilename
   m.lcFilename=getfile()
   if empty(m.lcfilename)
   return .f.
   endi
       local  oFSO,oFile
	oFSO = NewObject("Scripting.FileSystemObject")
	oFile =oFSO.GetFile(lcFilename)
	local m.myvar
	text to m.myvar textmerge  noshow
	         -file: <  < m.lcfilename >  >
	
	- Date created       : < <ttoc(oFile.DateCreated)> >
	- Date Last modified : < <ttoc(oFile.DateLastModified)> >
	- Date last Accessed : < <ttoc(oFile.DateLastAccessed)> >
	endtext
	messagebox(m.myvar)
	oFile = Null
	oFSO = Null
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform