Problem mit CFtpFileFind



  • hallo
    hab das problem das er bei mir nach dem ersten FindNextFile() einfach false zurückgibt obwohl 100 % ig mehrere ordner da sind
    die funktion soll einfach nur alle ordner auslesen und dessen namen in eine txt schreiben hier die funktion evtl können ja noch andre fehler gesehen werden 🙂

    void myclass::writetotxt()
    {
        m_ListView.DeleteAllItems();
        CFtpFileFind ftpFileFind(m_pFtpConnection);
    
        bool gotFile = false;
        bool gotSubFile = false;
        CString sSize;
        ftpFileFind.FindFile();  
        do
        {    
            gotFile = ftpFileFind.FindNextFile();
            if(gotFile)
            {
                if(ftpFileFind.IsDirectory()) 
                {       
                    CString oldDir,temp;
                    temp = ftpFileFind.GetFileName();
                    WriteTXT(temp);
                    m_pFtpConnection->GetCurrentDirectory(oldDir);
                    m_pFtpConnection->SetCurrentDirectory(temp);
                    if(ftpFileFind.FindFile())
                    {
                        WriteTXT("\n========%%           SubDirs            %%========\n");
                        do
                        {
                            gotSubFile = ftpFileFind.FindNextFile();
                            if(gotSubFile)
                            {
                                int size = (int)ftpFileFind.GetLength();
                                size = size / 1000000;
                                temp.Format("%d", size);
                                WriteTXT("\t"+ftpFileFind.GetFileName() + " Grösse : " + temp + " mb"); 
                            }
                        }
                        while(gotSubFile);
                        WriteTXT("\n========%%                              %%========\n");
                    }
                }
                else 
                {   
                    int size = (int)ftpFileFind.GetLength();
                    size = size / 1000000;
                    sSize.Format("%d", size);
                    sSize +=  " mb";
                    WriteTXT(ftpFileFind.GetFileName() + " Grösse : " + sSize);
                }
            }
        }
        while(gotFile); 
    }
    

    cy SpliFF



  • das genaue ergenis sieht so aus

    *ORDNER1

    ========%% SubDirs %%========

    ORDNER1_ORDNER1 : 0 mb
    ORDNER1_ORDNER2 : 0 mb
    ORDNER1_ORDNER3 : 0 mb
    ORDNER1_ORDNER4 : 0 mb
    ORDNER1_ORDNER5 : 0 mb

    ========%% %%========
    *
    obwohl noch 4 andere ordner vorhanden sind mit auch jeweils 5 unterordnern.... 😕



  • Wo wechselst du denn wieder in das übergeordnete verzeichnis?



  • Ups das hatte ich wohl vergessen muss daran gelegen ham das ich nen bissi rumprobiert habe aber auch damit ist das ergebnis das gleiche

    void myClass::writetotxt()
    {
        m_ListView.DeleteAllItems();
        CFtpFileFind ftpFileFind(m_pFtpConnection);
    
        bool gotFile = false;
        bool gotSubFile = false;
        CString sSize;
        ftpFileFind.FindFile();  
        do
        {   /*m_pFtpConnection->SetCurrentDirectory("/");*/
            gotFile = ftpFileFind.FindNextFile();
            if(gotFile)
            {
                if(ftpFileFind.IsDirectory()) 
                {       
                    CString oldDir,temp;
                    temp = ftpFileFind.GetFileName();
                    WriteTXT(temp);
                    m_pFtpConnection->GetCurrentDirectory(oldDir);
                    m_pFtpConnection->SetCurrentDirectory(temp);
                    if(ftpFileFind.FindFile())
                    {
                        WriteTXT("\n========%%           SubDirs            %%========\n");
                        do
                        {
                            gotSubFile = ftpFileFind.FindNextFile();
                            if(gotSubFile)
                            {
                                int size = (int)ftpFileFind.GetLength();
                                size = size / 1000000;
                                temp.Format("%d", size);
                                WriteTXT("\t"+ftpFileFind.GetFileName() + " Grösse : " + temp + " mb"); 
                            }
                        }
                        while(gotSubFile);
                        WriteTXT("\n========%%                              %%========\n");
                    m_pFtpConnection->SetCurrentDirectory(oldDir); // hier wird wieder in das root dir gewechselt
                    }
                }
                else 
                {   
                    int size = (int)ftpFileFind.GetLength();
                    size = size / 1000000;
                    sSize.Format("%d", size);
                    sSize +=  " mb";
                    WriteTXT(ftpFileFind.GetFileName() + " Grösse : " + sSize);
                }
            }
        }
        while(gotFile); 
    }
    

    MfG SpliFF



  • argh verdammt muss mich mal reggen scheiss mehrfach posts aknn aber ned editieren 😢
    da war jetzt noch nen fehler drin so stimmts denk ich

    if(ftpFileFind.IsDirectory()) 
                {       
                    CString oldDir,temp;
                    temp = ftpFileFind.GetFileName();
                    WriteTXT(temp);
                    m_pFtpConnection->GetCurrentDirectory(oldDir);
                    m_pFtpConnection->SetCurrentDirectory(temp);
                    if(ftpFileFind.FindFile())
                    {
                        WriteTXT("\n========%%           SubDirs            %%========\n");
                        do
                        {
                            gotSubFile = ftpFileFind.FindNextFile();
                            if(gotSubFile)
                            {
                                int size = (int)ftpFileFind.GetLength();
                                size = size / 1000000;
                                temp.Format("%d", size);
                                WriteTXT("\t"+ftpFileFind.GetFileName() + " Grösse : " + temp + " mb"); 
                            }
                        }
                        while(gotSubFile);
                        WriteTXT("\n========%%                              %%========\n");
                    }
                    m_pFtpConnection->SetCurrentDirectory(oldDir); // hier wird wieder in das root dir gewechselt
                }
                else
    


  • letzter versuch

    *pushup*


Anmelden zum Antworten