Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Full Drive Directory Listing
Message
De
16/05/2001 05:12:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/05/2001 15:57:25
Robert Herrmann
Tx Dept. of Health - Cancer Registry
Austin, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00507479
Message ID:
00507708
Vues:
9
>Is there a way to get an entire drive listing with all the files in each directory and have it output to a table where searches can be made for
>duplicate files or files created before a certain date??
>I have an approx. 40 gig network drive that I need to be able to run this search on where it gives the directory that the files are in and a listing
>of all files that have duplicates and are older than a certain date. the search for duplicate records and dates I can do after the drive creation if necessary.. but of course it would be easier if this search can be done as it does the drive listing :) I found the adir() command but it only seems to give a file and dir. listing of that dir. you are currently in and it's not recursive
>like I need it to be.. Any help would be greatly appreciated!
>
>Thanks in advance!

Robert,
You could use adir() if you don't want to access all dirs and files. Otherwise filesystemobject have better capabilities. Doing check after creation sounds better. Here is a version I use for similar purposes :
*Sample call
Gettree('c:\recycled',.t.)

Function Gettree
Lparameters tcDirectory, tlFiles
Start = seconds()
Create cursor crsFiles ;
  (FolderId i, Filename m, FileSize i, Created t, Modified t, Accessed t)
Create cursor crsFolders (Folder m, FolderId i)

oFS = CREATEOBJECT('Scripting.FileSystemObject')
oFolder = oFS.GetFolder(tcDirectory)
Insert into crsFolders ;
  (Folder , FolderId ) ;
  values ;
  (oFolder.Path, reccount('crsFolders')+1)
If tlFiles
   GetFiles(oFolder, reccount('crsFolders'))
Endif
=_SubFolders(oFolder, tlFiles)
? seconds()-start
Go top
Browse

Function _SubFolders
Lparameters toFolder, tlFiles
Local loSubFolders
For each oSubFolder in toFolder.Subfolders
  If oSubFolder.Name # "System Volume Information"
    Insert into crsFolders (Folder , FolderId ) ;
      values (oSubFolder.Path, reccount('crsFolders')+1)
    If tlFiles
      GetFiles(oSubFolder, reccount('crsFolders'))
    Endif
    =_SubFolders(oSubFolder, tlFiles)
  Endif
Endfor

Function GetFiles
Lparameters toFolder, tnId
For each oFile in toFolder.Files
  Insert into crsFiles ;
    (FolderId, Filename, FileSize, Modified, Accessed , Created ) ;
    values ;
    (tnId, oFile.Name, oFile.Size, ;
    oFile.DateCreated, oFile.DateLastModified, oFile.DateLastAccessed)
Endfor
You probably would better change memo fields to char fields for indexing. Instead of 2 tables you could as well just create one table (crsFiles) including oFile.Path.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform