findfirst() findnext()

how to recurse through the directories and list the files names of all init


any sample code or app?


--
Thanks,

Arvind


0
arvinds (9)
1/3/2005 1:38:43 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1153 Views

Similar Articles

[PageSpeed] 35

Here is an example of how to use MFC's CFileFinder class which encapsulates
the findfirst and findnext methods.  Anyway the concept is the same.

int NumberOfFiles(CString strDir)
{
   int nFiles = 0;
   CFileFind finder;
   BOOL bWorking = finder.FindFile(strDir+"\\*.*");
   while(bWorking)
   {
      YeildToOthers();
      bWorking = finder.FindNextFile();
      if(!finder.IsDots())
      {
         if(!finder.IsDirectory())
         {
            nFiles++;
         }
         else
         {
            nFiles += NumberOfFiles(finder.GetFilePath());
         }
      }
   }
   return nFiles;
}

AliR.
"Arvind" <arvinds@erivasystems.com> wrote in message
news:%23VVpnmZ8EHA.1204@TK2MSFTNGP10.phx.gbl...
> how to recurse through the directories and list the files names of all
init
>
>
> any sample code or app?
>
>
> --
> Thanks,
>
> Arvind
>
>


0
AliR (178)
1/3/2005 4:28:20 PM
Try This
http://www.codeproject.com/file/win32findfile.asp

--

With Regards
Alok Gupta
Visit me at http://alok.bizhat.com

                           "I think this will Help"
"Arvind" <arvinds@erivasystems.com> wrote in message
news:#VVpnmZ8EHA.1204@TK2MSFTNGP10.phx.gbl...
> how to recurse through the directories and list the files names of all
init
>
>
> any sample code or app?
>
>
> --
> Thanks,
>
> Arvind
>
>


0
thatsalok1 (226)
3/3/2005 9:41:04 AM
Reply:

Similar Artilces:

CDaoRecordset::FindFirst() usage
As a novice on database, I am trying to use CDaoRecordset::FindFirst() function just to check if certain 'Serial Number' exists in other table but it throws following error: Error(3077): Syntax error (missing operator) in expression. Please see following code: .... ASSERT(m_pDB->IsOpen()); CDaoTableDef td(m_pDB); CDaoRecordset rs(m_pDB); // convert serial number string to long number char *end; long UnitNum=lstrtol(GetSerialNum(),&end,10); BOOL faulty = FALSE; try { td.Open((LPCTSTR)(_T("Table 1"))); } catch (CDaoException* e) { m_pView->DisplayD...

Problem with FindNext in Recordset object
Hi, The following code doesn't work. FindNext doesn't move at all and stays at the first record found. While Loop seems entering into a never ending loop. If I use .MoveFirst and .MoveNext in stead of .FindFirst and .FindNext, it works and can move through the whole recordset. Anything wrong with my code? Thank you. Dim dbObject As Database Dim rstObject As Recordset Dim strSQL As String Dim strChartNo As String Set dbObject = CurrentDb strSQL = "SELECT tblPatient.ChartNo, tblAdmission.* _ FROM tblPatient _ INNER JOIN...

findfirst
I have a form with 6 fields on it, some text boxes and some combo boxes. The first box is a combo box of names. The second box is the person's ID number. I have set up a findfirst method so that when you select a name from the first box, the id for that person shows in the second box (if that person is in the list). The rest of the boxes on the form are more info on that person. I want those fields to fill in as well as the ID field when I select the name from the first box. I can't seem to figure out the code. I keep getting the id number in all the fields after I select the na...

Findfirst type mismatch error
So I'm stumped I have two fields that are able to have duplicates in them but combined will not so I need to do my search criteria to include both of them Private Sub Command3_Click() Dim MyRst As DAO.Recordset Dim InputString As String Dim acn2 As String InputString = find acn2 = accountnumber2 Set MyRst = Me.RecordsetClone MyRst.FindFirst "[InvNum] = " & (InputString) And "[AccountNumber] = " & Me![accountnumber2] If MyRst.NoMatch Then MsgBox ("No Data with this ID found") Else Me.Bookmark = MyRst.Bookmark End If MyRst.Close Set MyRst = Nothing ...

findfirst() findnext()
how to recurse through the directories and list the files names of all init any sample code or app? -- Thanks, Arvind Here is an example of how to use MFC's CFileFinder class which encapsulates the findfirst and findnext methods. Anyway the concept is the same. int NumberOfFiles(CString strDir) { int nFiles = 0; CFileFind finder; BOOL bWorking = finder.FindFile(strDir+"\\*.*"); while(bWorking) { YeildToOthers(); bWorking = finder.FindNextFile(); if(!finder.IsDots()) { if(!finder.IsDirectory()) { nFiles...

FindFirst with numeric field
For some reason I'm having a lot of problems getting a findfirst to work. First I tried comparing to a text field but that didn't work. Now I'm trying to compare to a numeric field (ID) but that's not working either. The first line is I believe correct for a text field. What is the correct syntax if the field is numeric? Thanks for any help on this. rsCategories.FindFirst "ID = '" & Category & "'" rsCategories.FindFirst "ID = " ???????? rsCategories.FindFirst "ID = " & Category -- Doug St...

FindFirst question
hello When using code to find a table record that matches a given value, does the 'FindFirst' need to be preceded by 'MoveFirst'? should the code read as... Dim... ......etc Set rs = Me.recordset.Clone rs.FindFirst strSearch .... or... Dim... ......etc Set rs = Me.recordset.Clone rs.MoveFirst rs.FindFirst strSearch .... When studying code samples in this site and others, I've seen it done both ways. Things seem to work fine without the MoveFirst, but maybe I'm just getting lucky. Is MoveFirst needed? Why/Why not? thanks in advance T...

FindFirst sticking with first record?
I have a combo box that queries from a table of people to get a list of names, ordered lastname, firstname, peopleID. There are several people in this list that have the same last name, and no matter which person I choose with that last name, Access chooses the first person with that last name. (So effectively, if I have Smith Jon 1, Smith Jane 8, Smith Harold 9074395, it'll always stick with Smith Harold 9074395.) The VBA behind this is: Private Sub Combo26_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs...

findfirst problem
Hi all, I have this piece of code which gives me an error : 3072 unknown function name when I execute rst2.FindFirst cKey. In immediate mode my cKey seems to be correct. Sub UpdateCustomer() Dim cCustomer As String, cNameCustomer As String, cKey As String Dim db As DAO.Database, rst As Recordset, rst2 As Recordset, wsp As Workspace Set wsp = DBEngine.Workspaces(0) Set db = CurrentDb Set rst2 = db.OpenRecordset("Customers", dbOpenSnapshot, dbReadOnly) rst2.MoveLast: rst2.MoveFirst Set rst = db.OpenRecordset("MyOtherTable", dbOpenDynaset) rst.MoveLast: rst.MoveFirst ...

What's happened to the findfirst function in Access 2010?
I have a working Access 2007 Application which is now failing miserably in 2010. It hinges on location the first available working document in a table runing the following VBA code: With Me.Recordset .FindFirst "([fld1] + [fld2]) = 0" If .NoMatch Then .FindLast "([fdl1] + [fld2]) <> 0" Exit Sub End If .... FURTHER PROCESSING ... What must I do to correct this? Go through a record by record search? End With In 2007, this works correctly, stopping at the appropriate record (approc. rec 1385 in the recordset...

Do I need .FindFirst?
Hi, I'm having problem with the code below not going to the form as needed. When CboTech (TechA) selects JobNumber from fttswitchboard and has time running on another job and he is the tech on record 1 in the fttWorkLogHiddenOpen form, then the fttWorkLogReminder form opens to his name. If TechB selects a job from the switchboard and he has time running on record 2 in the fttWorkLogHiddenOpen form then it bypasses the fttWorkLogReminder form and opens the fGenInfoTT at the job number selected and allows him to start another job in addition to the one he already has ope...

FindFirst not working in 2007
I am having a problem with a very simple FindFirst command not working. I thought it was me but I opened an old database and it will not work there either (that one is in 2002). I do get one to work when I call it from the switchboard option but when opening in design and running it there, it doesn't work. Any ideas? I just got 2007 so there may be a control or something that I am not aware of. Becky, you may need to tell Access 2007 that your database is in a trusted folder. Otherwise not code will run. To do this, go to: Office Button | Access Options | Trust Center | Tru...

using recordset findfirst
I have created a recordset that is a subset of records from another table based on age and gender. Three of the columns in the recordset (among others) are a Score, HighLimit and LowLimit. I need to determin if sngCurlUpCount: - is greater than the largest value in the HighLimit - or lower thant the lowest value in the HighLimit . 'This returns my recordset of 4 rows Dim strSQL As String 'Query the look up table rows for the passed age and gender. strSQL = "SELECT * " & _ "FROM MECurlUpTable " & _ "WHERE AgeLowLimit < " &a...

FindFirst method not found
I'm trying to use the .FindFirst method on a recordset clone using very generic code, but neither .FindFirst or .NoMatch are recognized. Help? Dim rs As Recordset Dim strFind as string Set rs = Me!RecordsetClone strFind = Me!txt_Find rs.Findfirst "[LastF] = " & strFind If rs.Nomatch Then MsgBox "No matches found.", vbOKOnly Else Me.Bookmark = rs.Bookmark End If Try: Dim rs As DAO.Recordset Set rs = Me.RecordsetClone Also, if LastF is a Text field (not a number field), you need extra quotes: rs.Findfirs...

FindFirst help with syntax
I need some help with the syntax. I have code like below. I want to find the record that has DWG#: in the comment. I add the word Like and then the astrisk after DWG#: but those don't seem to work. What would be the proper syntax? rs1.FindFirst "COMMENT Like 'DWG#:*'" -- Matt Campbell mattc (at) saunatec [dot] com Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200709/1 Try this ---- rs1.FindFirst "COMMENT Like '*DWG#:*'" -- KARL DEWEY Build a little - Test a little "mattc66 via Acc...

FindFirst
Ok, I'm sure this is a syntax thing. I'm trying to find a record on a form based on the members selected via two different criteria. For the following statement rs.FindFirst "[ConvActivityRtgID] = " & [TARSkillClusterID] = lstGroupingSelect " AND "&[AASSID] = LstAASSselect" I get an "expected end of expression" error somewhere around the "and" section of the statement. Can anyone tell me what I'm doing wrong? Thanks in advance! "WestWingFan" <WestWingFan@discussions.microsoft.com> wrote in message news:ED...

Edit record after FindFirst in CDaoRecordset
I am trying to edit a CDaoRecordset that is open dynaset. The online doc. for FindFirst said: "If Find returns nonzero, the current record is not defined. In this case, you must position the current record pointer back to a valid record." I take this to mean that I need to do a MovePrev() before I edit the record, but this seem not to be right. I edit the wrong record or throw an exception. What is the right way to edit a record after a FindFirst(). Thanks "David Briggs" <dlbriggs1729@yahoo.com> ???????/???????? ? ???????? ?????????: news:376a9322.0408020810.28c...

findFirst record bookmark not working
Hello, I am trying to keep focus in a specific record in frmDetalheMovFinanc , and it works fine if i set breakpoints in my code. But when I clear all break points, it moves focus in that subform to another record Can you help me Thanks Carlos Code that I have in the OnCurrent event of my form On Error Resume Next If Not IsNull(Me.OpenArgs) Then Dim pass Dim frm As Form pass = Me.OpenArgs pass = Eval(pass) ' if i dont do this it reads a string Set frm = Forms![frmMovFinanc]![frmDetalheMovFinanc].Form frm.Requery ' if i put a break point here the code works fine and when the for...

Bookmark FindFirst broken after 450 records
In Access 2003. I have a form, and a subsiquent pop-up form. Here's the code on the parent form (called directly from a command button click event): Private Sub SizeWeightForm() 'Open the size/weight form DoCmd.OpenForm "frmSizeWeight" 'Move to current record Forms.frmSizeWeight.RecordsetClone.FindFirst "[PRODUCT_ID] = '" & Me.PRODUCT_ID & "'" Forms.frmSizeWeight.Bookmark = Me.RecordsetClone.Bookmark End Sub This code has worked for just over 450 records. Now it won't run for any subsiquent records, although it continues to work ...

Findfirst NOT working with DAO.Recordset
Can anyone tell what is wrong with the following code? I am getting an error 3251 "operation is not supported for this type of object" I've searched the forums but everywhere it is said to use DAO recordset but that's what i am using !! Any help will be appreciated. Here's the code: Dim dbProjet As DAO.Database Dim tdfProjet As DAO.TableDef Dim rstProjet As DAO.Recordset Dim ProjectNumber As Long Set dbProjet = Nothing Set tdfProjet = Nothing Set rstProjet = Nothing Set dbProjet = CurrentDb Set tdfProjet = dbProjet.TableDefs("tblProjets") ' Opens the T...

findfirst
i wish to find a record based on 2 criteria, in this case i wish to search for a particular job id and then date type as each job id could have a multiple amount of date types. rs.Findfirst "[Job ID] = " & aJob AND "[Date Type] = " &aDate i am not sure how to program the AND. -- thanks liz liz wrote: > i wish to find a record based on 2 criteria, in this case i wish to > search for a particular job id and then date type as each job id > could have a multiple amount of date types. > > rs.Findfirst "[Job ID] = " & aJob AND "[...

rst.findfirst not working with two conditions
i have a table with two date fields and i opened a dao recordset (based on a query) on it .Now i want to search whether a particular date group falls between these dates and the rate for that period.Dates in UK style. FromDate ToDate Rate 01/01/2009 31/03/2009 7570 01/05/2009 30/11/2009 7770 01/12/2009 31/12/2009 7970 //variables declared here //SQL is defined here to limit it the recordset Set rst = currentdb.OpenRecordset(strSQL, dbOpenDynaset) MyFromDAte = 01/06/2009 MyToDate = 31/10/2009 rst.Findfirst "[FromDate] &...

Recordset.FindFirst 09-19-07
Hello. I have a form (single form view) with a subform (data sheet view). On the form I have a Case# field and I have create a "Previous" and "Next" button. I find myself having to use the Previous and Next button all the time. Do you know of a way that I could add a text box where I can type a case number then click an Ok button next to so that the Correct Case# can appear on the form? Thanks. Your help is greatly appreciated. Iram/mcp Rather than creating extra controls on your form, why not use the built-in search functionality? You could press Ctrl+F while on ...

2 finds/findnext in nested loops
I am trying to build a table that lists projects and hours worked for that project for each day of the week. I start by doing a find on my timesheet sheet for a certain date if I find an entry for that date I then want to do a find on my project number column on the display sheet to see if that project already has an entry (if it does I want to add more hours for that date). I have this working ok my problem is that when I finish checking for the project number I exit out of that loop and fall back into the loop looking for the date and this find next is trying match on the ...

RecordSet.FindFirst 03-28-07
Hi. I have a combo box to find an exiting member: Private Sub CmbSearch_AfterUpdate() ' Find the record that matches the control. Me.RecordsetClone.FindFirst "[ContactID] = " & Me![cmbSearch] Me.Bookmark = Me.RecordsetClone.Bookmark Me!cmbSearch = Null End Sub The user uses the combo box to locate a member and if the member doesn't exist, receives an Access box: the test you entered doesn't exist. Then the user clears out the combo box field and clicks on the new record button and receives a run-time error 3077: syntax error (missing operator) in...