Robs Programming Junk
Welcome to my programming blog!With some luck you will find some tasty nuggets of information here. If you do find something please post a comment on where or how you used it. I like to see what sort of impact my work has on others.
Wednesday, February 08, 2006
FOXPRO: Using a filesystem object instead of ADIR()
ADIR() is a very bad thing. Large directories are very very slow to read and can even crash with TOO MANY VARIABLES because of the foxpro array limitation. This snippet allows me to get around that.
include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');
$source = <<
loFSO=CREATEOBJECT('Scripting.FileSystemObject')
lsDrive=SYS(5)
loFolders=loFSO.GetFolder(lsDrive+'\\\somefolder')
FOR EACH loSomeFolder IN loFolders.Subfolders
IF !FILE(lsDrive+'\\\somefolder\\\'+ALLT(loSomeFolder.NAME))
WAIT WINDOW 'Checking '+ lsDrive+'\\\somefolder\\\'+ALLT(loSomeFolder.NAME) NOWAIT
FOR EACH loFile IN loSomeFolder.FILES
* DO SOMEHTING WITH THE FILE
* lsDrive+'\\\somefolder\\\'+ allt(loSomeFolder.Name)+'\\\'+allt(loFile.Name)
ENDFOR
ENDIF
ENDFOR
RELEASE loFolders
RELEASE loFile
RELEASE loFSO
WAIT CLEAR
END;
$geshi = new GeSHi($source, 'visualfoxpro');
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->set_overall_style('font-family: Courier New , Courier, Monospace; font-size: 8pt; word-wrap:break-word;');
$geshi->set_comments_style(1, 'color: #006600;');
$geshi->set_comments_style('MULTI', 'color: #006600;');
$geshi->set_header_content('Code Example © Robert Mech. May be used freely as long as credit is given to the source.');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('If you use this code, please make a comment on the blog!');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
echo $geshi->parse_code();
?>
include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');
$source = <<
loFSO=CREATEOBJECT('Scripting.FileSystemObject')
lsDrive=SYS(5)
loFolders=loFSO.GetFolder(lsDrive+'\\\somefolder')
FOR EACH loSomeFolder IN loFolders.Subfolders
IF !FILE(lsDrive+'\\\somefolder\\\'+ALLT(loSomeFolder.NAME))
WAIT WINDOW 'Checking '+ lsDrive+'\\\somefolder\\\'+ALLT(loSomeFolder.NAME) NOWAIT
FOR EACH loFile IN loSomeFolder.FILES
* DO SOMEHTING WITH THE FILE
* lsDrive+'\\\somefolder\\\'+ allt(loSomeFolder.Name)+'\\\'+allt(loFile.Name)
ENDFOR
ENDIF
ENDFOR
RELEASE loFolders
RELEASE loFile
RELEASE loFSO
WAIT CLEAR
END;
$geshi = new GeSHi($source, 'visualfoxpro');
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->set_overall_style('font-family: Courier New , Courier, Monospace; font-size: 8pt; word-wrap:break-word;');
$geshi->set_comments_style(1, 'color: #006600;');
$geshi->set_comments_style('MULTI', 'color: #006600;');
$geshi->set_header_content('Code Example © Robert Mech. May be used freely as long as credit is given to the source.');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('If you use this code, please make a comment on the blog!');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
echo $geshi->parse_code();
?>
View my portfolio at iFreelance.com
Hire MechSoftware for Quality Assurance (QA), Database Programming, and Security Design/Programming
Find QA Freelance Jobs at iFreelance.com
Hire MechSoftware for Quality Assurance (QA), Database Programming, and Security Design/Programming
Find QA Freelance Jobs at iFreelance.com
Recent Posts
Setting Up Apache SOAP
Java(TM) Boutique - Using SOAP with Java
www.KickJava.com: About Us
A simple SOAP client
Java Service Wrapper
Archives
01/01/2005 - 02/01/200502/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010
My Software
Blinky - GBPVR PluginPhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers
Programming Links
C# FormatterNSIS
Other Links
Damn Small LinuxSites I Manage
Do it yourself SEO. Cheap.Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking