<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Rekursives finden von Dateien]]></title><description><![CDATA[<p>Hallo!<br />
Ich habe mir eine Funktion geschrieben, die einem Ordner + allen Unterorndnern Dateien auslesen soll.<br />
funktioniert bei mir aber nicht (geht immer nur in den 1. Unterornder, dann wieder in den nächsten 1.Unterordner,...)<br />
Was habe ich falsch gemacht!<br />
Bitte um Hilfe!!!<br />
Hier der Code:</p>
<p>code type=&quot;c++&quot;]<br />
void CFindfilesDlg::FindFiles(CString find){<br />
struct _finddata_t fInfo;<br />
long hFile;</p>
<p>if( (hFile = _findfirst( find, &amp;fInfo)) == 1L){</p>
<p>}else{<br />
while( _findnext( hFile, &amp;fInfo ) == 0){<br />
CString info = <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>;<br />
int found = info.ReverseFind('.');<br />
if(found == -1){<br />
if(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;.&quot; &amp;&amp; <a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;..&quot;){<br />
int pos = find.ReverseFind('<em>');<br />
find.Replace(&quot;</em>.<em>&quot;, <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
find += &quot;\*.</em>&quot;;<br />
FindFiles(find);<br />
}<br />
}<br />
m_list.AddString(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
}<br />
_findclose( hFile );<br />
}<br />
}[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/6269/rekursives-finden-von-dateien</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 06:34:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/6269.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Jun 2003 15:12:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 15:12:00 GMT]]></title><description><![CDATA[<p>Hallo!<br />
Ich habe mir eine Funktion geschrieben, die einem Ordner + allen Unterorndnern Dateien auslesen soll.<br />
funktioniert bei mir aber nicht (geht immer nur in den 1. Unterornder, dann wieder in den nächsten 1.Unterordner,...)<br />
Was habe ich falsch gemacht!<br />
Bitte um Hilfe!!!<br />
Hier der Code:</p>
<p>code type=&quot;c++&quot;]<br />
void CFindfilesDlg::FindFiles(CString find){<br />
struct _finddata_t fInfo;<br />
long hFile;</p>
<p>if( (hFile = _findfirst( find, &amp;fInfo)) == 1L){</p>
<p>}else{<br />
while( _findnext( hFile, &amp;fInfo ) == 0){<br />
CString info = <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>;<br />
int found = info.ReverseFind('.');<br />
if(found == -1){<br />
if(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;.&quot; &amp;&amp; <a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;..&quot;){<br />
int pos = find.ReverseFind('<em>');<br />
find.Replace(&quot;</em>.<em>&quot;, <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
find += &quot;\*.</em>&quot;;<br />
FindFiles(find);<br />
}<br />
}<br />
m_list.AddString(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
}<br />
_findclose( hFile );<br />
}<br />
}[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30446</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30446</guid><dc:creator><![CDATA[steve]]></dc:creator><pubDate>Fri, 20 Jun 2003 15:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 15:14:00 GMT]]></title><description><![CDATA[<p>Hier noch mal der Code - Mit code Tags <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
code type=[&quot;c++&quot;]<br />
void CFindfilesDlg::FindFiles(CString find){<br />
struct _finddata_t fInfo;<br />
long hFile;</p>
<p>if( (hFile = _findfirst( find, &amp;fInfo)) == 1L){</p>
<p>}else{<br />
while( _findnext( hFile, &amp;fInfo ) == 0){<br />
CString info = <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>;<br />
int found = info.ReverseFind('.');<br />
if(found == -1){<br />
if(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;.&quot; &amp;&amp; <a href="http://fInfo.name" rel="nofollow">fInfo.name</a> != &quot;..&quot;){<br />
int pos = find.ReverseFind('<em>');<br />
find.Replace(&quot;</em>.<em>&quot;, <a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
find += &quot;\*.</em>&quot;;<br />
FindFiles(find);<br />
}<br />
}<br />
m_list.AddString(<a href="http://fInfo.name" rel="nofollow">fInfo.name</a>);<br />
}<br />
_findclose( hFile );<br />
}<br />
}[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30447</guid><dc:creator><![CDATA[steve]]></dc:creator><pubDate>Fri, 20 Jun 2003 15:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 15:15:00 GMT]]></title><description><![CDATA[<p>Tschudldigung Merk ich mir nie wie das geht mit den Code Tags!</p>
<pre><code class="language-cpp">void CFindfilesDlg::FindFiles(CString find){ 
struct _finddata_t fInfo;
long hFile;

if( (hFile = _findfirst( find, &amp;fInfo)) == 1L){

}else{ 
while( _findnext( hFile, &amp;fInfo ) == 0){
CString info = fInfo.name;
int found = info.ReverseFind('.');
if(found == -1){
if(fInfo.name != &quot;.&quot; &amp;&amp; fInfo.name != &quot;..&quot;){
int pos = find.ReverseFind('*');
find.Replace(&quot;*.*&quot;, fInfo.name);
find += &quot;\\*.*&quot;;
FindFiles(find);
}
}
m_list.AddString(fInfo.name);
}
_findclose( hFile );
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/30448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30448</guid><dc:creator><![CDATA[steve]]></dc:creator><pubDate>Fri, 20 Jun 2003 15:15:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 15:44:00 GMT]]></title><description><![CDATA[<p>Du hast 2 Möglichkeiten:</p>
<ul>
<li>du willst MFC Programmieren - Nimm CFileFind.</li>
<li>du willst es so machen, dann poste es ins WinApi forum.</li>
</ul>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30449</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Fri, 20 Jun 2003 15:44:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 16:46:00 GMT]]></title><description><![CDATA[<p>BTW: Es gibt auch Buttons für die Code-Tags rechts unter dem Edit-Feld in das du deine Antwort schreibst <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30450</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30450</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Fri, 20 Jun 2003 16:46:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 20:47:00 GMT]]></title><description><![CDATA[<p>Hallo!<br />
Ja dann nehme ich halt CFileFind, funktiniert ja fast identisch:<br />
Nur wie mache ich solche eine Rekursion???<br />
Bitte um Hilfe!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30451</guid><dc:creator><![CDATA[steve]]></dc:creator><pubDate>Fri, 20 Jun 2003 20:47:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Fri, 20 Jun 2003 21:01:00 GMT]]></title><description><![CDATA[<p>Ich mach das so mit zwei Member-Funktionen:</p>
<pre><code>////////////////////////////
// Verzeichnisse Kopieren //
////////////////////////////

long CVerzeichnisKopierenDlg::SnapshotFiles(CString pstrSourcePath)
{
    BOOL bMore;
    WIN32_FIND_DATA wfd;
    HANDLE handle;
    CString szMask;
    CString szFullName;

    szMask = pstrSourcePath + &quot;\\*.*&quot;;      //Suchmaske für FindFirstFile

    handle = ::FindFirstFile(szMask, &amp;wfd);
    bMore = handle != INVALID_HANDLE_VALUE;

    while(bMore)
    {
        if(wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
        {
            if( ((strcmp(wfd.cFileName, &quot;.&quot;)  != 0) &amp;&amp; 
                 (strcmp(wfd.cFileName, &quot;..&quot;) != 0)) )      // filename is a directory
            {
                szFullName = pstrSourcePath + &quot;\\&quot; + wfd.cFileName;
                SnapshotFiles(szFullName);  //Funktion rekursiv aufrufen
            }/*if*/
        }/*if*/

        else
        {
            CString SourceFile = pstrSourcePath + &quot;\\&quot; + wfd.cFileName;
            m_lNumFiles++;

            MSG msg;
            int Return = PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE);
            if (Return!=0)
            {
                TranslateMessage(&amp;msg);
                DispatchMessage(&amp;msg);
            }
        }/*else*/

        bMore = ::FindNextFile(handle,&amp;wfd);

    }/*while*/

    if (handle!=INVALID_HANDLE_VALUE) ::FindClose(handle);

    return m_lNumFiles;
}////////////////////Ende Member-Funktion 

BOOL CVerzeichnisKopierenDlg::XcopyFiles(CString pstrSourcePath, CString pstrTargetPath, long m_lNumFiles)
{
    BOOL bMore;
    WIN32_FIND_DATA wfd;
    HANDLE handle;
    CString szMask;
    CString szFullName;
    CString szTargetName;

    m_ctlButton_Stop.EnableWindow(TRUE);

    CreateDirectory(pstrTargetPath, NULL);  //Zielverzeichnis erstellen
    szMask = pstrSourcePath + &quot;\\*.*&quot;;      //Suchmaske für FindFirstFile

    handle = ::FindFirstFile(szMask, &amp;wfd);
    bMore = handle != INVALID_HANDLE_VALUE;

    while(bMore&amp;&amp;(m_bIsKilled!=TRUE))
    {
        if(wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
        {
            if( ((strcmp(wfd.cFileName, &quot;.&quot;)  != 0) &amp;&amp; 
                 (strcmp(wfd.cFileName, &quot;..&quot;) != 0)) )      // filename is a directory
            {
                szFullName = pstrSourcePath + &quot;\\&quot; + wfd.cFileName;
                szTargetName = pstrTargetPath + &quot;\\&quot; + wfd.cFileName;
                CreateDirectory(szTargetName, NULL);        //Ziel-Unterverzeichnisse erstellen
                m_ctlStaticDirectory.SetWindowText(szFullName); //Verzeichnis anzeigen
                m_ctlListBox.AddString(szFullName);         //Verzeichnis in Liste zufügen
                UpdateWindow();                             //Aktualiserung der ListBox
                XcopyFiles(szFullName, szTargetName, m_lNumFiles ); //Funktion rekursiv aufrufen
            }/*if*/
        }/*if*/

        else
        {
            CString SourceFile = pstrSourcePath + &quot;\\&quot; + wfd.cFileName;
            CString TargetFile = pstrTargetPath + &quot;\\&quot; + wfd.cFileName;
            m_ctlStaticFile.SetWindowText(wfd.cFileName);
            ::CopyFile(SourceFile, TargetFile, TRUE);   //Datei wird kopiert, 
                                                        //TRUE:  File wird nicht überschrieben
                                                        //FALSE: File wird überschrieben

            MSG msg;
            int Return;
            Return = PeekMessage( &amp;msg, NULL, 0, 0, PM_REMOVE);
            if (Return!=0)
            {
                TranslateMessage(&amp;msg);
                DispatchMessage(&amp;msg);
            }

            //  Prozentanteil kopierter Dateien, lNumFiles entspricht 100%.                            
            m_lZaehler++;
            m_iProzent = (int) ( m_lZaehler*100 / m_lNumFiles );

            CString string;
            string.Format( &quot;%i&quot;, m_iProzent );  m_ctlStaticProzent.SetWindowText( string );
            string.Format( &quot;%i&quot;, m_lZaehler);   m_ctlStaticNumberFiles.SetWindowText( string );

        }/*else*/

        bMore = ::FindNextFile(handle,&amp;wfd);

    }/*while*/

    if (handle!=INVALID_HANDLE_VALUE) ::FindClose(handle);

    return TRUE;
}////////////////////Ende Member-Funktion
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/30452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30452</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Fri, 20 Jun 2003 21:01:00 GMT</pubDate></item><item><title><![CDATA[Reply to Rekursives finden von Dateien on Sat, 21 Jun 2003 06:24:00 GMT]]></title><description><![CDATA[<p>Wie wäre es mal mit der Nachschau in den FAQ.<br />
<a href="http://www.c-plusplus.net/forum/topic,39130.html" rel="nofollow">Alle Verzeichnisse sowie Dateinamen ausgeben?</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/30453</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30453</guid><dc:creator><![CDATA[Unix-Tom]]></dc:creator><pubDate>Sat, 21 Jun 2003 06:24:00 GMT</pubDate></item></channel></rss>