>Does anyone know why these lines of code wont work?
>What happens is.. The filesystemobject is created fin and the 2 for loops start and the INSERT command works the first time. But after the INSERT it totally hangs... DEAD VFP6! If I dont have the INSERT statement in there it works fine. So it must have something to do with the combination between using the filesystemobject and trying to use the SQL - INSERT command. I must be doing something fundamentally wrong or have found an obsure bug. I appreciate all your feedback in advance.
>
>****
>*The purpose of this prg is to
>*find all of the free tables in our class system
>*
>*1. Find all tables in our system
>*2. Find all tables in our DBC's
>*compare lists
>SET STEP ON
>CLOSE ALL
>cClassDir = "e:\class\"
>cSaveDir = "e:\data\findfree\"
>CREATE TABLE (cSaveDir +"classtables") ;
> (tablename c(15), ;
> tablepath C(30) ,;
> dbcname C(30) ,;
> lastaccess D ,;
> InDBC L)
>curtable=""
>***Create filesystem object
>lofilesystem=createobject("scripting.filesystemobject")
>lofolder=lofilesystem.getfolder(cClassDir)
>***Loop throiugh all subfolders
>FOR EACH losubfolder IN loFolder.SubFolders
> FOR EACH lofile IN losubfolder.files
> IF lofilesystem.GetExtensionName(lofile.name) = "DBF"
> INSERT INTO classtables (;
> tablename,;
> tablepath,;
> lastaccess,;
> InDBC;
> ) VALUES (;
> lofile.name,;
> lofile.path,;
> lofile.DateLastAccessed,;
> .F.)
> ENDIF
> ENDFOR
>ENDFOR
>INDEX ON tablename TAG tablename
Daniel,
I'm not sure if this maybe the problem. Try this :
FOR EACH losubfolder IN loFolder.SubFolders
if loSubFolder.Name # "System Volume Information"
Cetin