QUOTE(kmoloney @ 22 Aug, 2008 - 07:35 AM)

i wish to loop through all files in a directory and copy all files of a given extension using PASCAL.
CODE
COPYLOCATION := 'C:\Documents and Settings\kmoloney\Desktop\Silver\';
For k := 0 To COPYLOCATION.FileCount - 1 Do
Begin
Document := COPYLOCATION.DM_LogicalDocuments(k);
//copy files to desired location
copyfile(document.DM_FullPath, REPORTLOCATION + document.DM_FileName, true);
//add all copied files to report
ReportFile.Add(Document.DM_FullPath);
End;
COPYLOCATION is the directory where the files i want to loop through are.
in my loop, obviously ".filecount" is wrong...... i was wondering if someone knew how to loop through all the files?
then i will use an if statement to only get the files with the extension i want.
and then ill just use the copyfile method as above.
please help!
how do i loop through the files in a directory??
umm i might be able to do that with batch even though i am not experienced not even for 1 year in programming but i got all the basics i just do a little research and i can build a batch file code for you if you will except a batch file or exe because i have a compiler too
EDIT wait actually i really do not know if i can do it i just read the rest of this post and i am not quite sure about it so i am sorry...
if only i could delete this post (because i do not like wasting data on websites so i just delete my posts if it was useless)
This post has been edited by coaster3000: 28 Aug, 2008 - 03:28 PM