Go to the documentation of this file.00001
00009 #include <iostream>
00010 #include "filesearch.h"
00011 #include <boost/thread.hpp>
00012
00013 void printout( Dedupe::FileSearch::FileStream output );
00014 void printout2( Dedupe::FileSearch::FileStream output );
00015 std::string return_typ( short typ );
00016 std::string return_bool( bool jn );
00017
00018
00019 using namespace std;
00020
00021
00022 void interface();
00023
00024 int main( int argc, char* argv[] )
00025 {
00026
00027 string program_path, search_path;
00028
00029 search_path = "/home";
00030
00031
00032 Dedupe::FileSearch::FileSearcher Search( search_path, true );
00033
00034 Search.Start();
00035 std::cout << "Searching..." << std::endl;
00036 while( Search.GetSearchState() == Dedupe::State::Run )
00037 {
00038 sleep(1);
00039 }
00040 printout( Search.GetFiles() );
00041 cout << "Anzahl der durchsuchten Dateien: "
00042 << Search.GetFileCounter() << endl;
00043 cout << "Anzahl der durchsuchten Verzeichnisse: "
00044 << Search.GetDirectoryCounter() << endl;
00045
00046 sleep(5);
00047
00048 printout2( Search.GetNotUsableFiles() );
00049
00050 return 0;
00051
00052 }
00053
00054
00055 void printout( Dedupe::FileSearch::FileStream output )
00056 {
00057
00058 for(Dedupe::FileSearch::FileStream::iterator iter=output.begin();
00059 iter!=output.end(); iter++)
00060 {
00061 cout << "Dateiname: " << iter->GetName() << " | "
00062 << "Dateipfad: " << iter->GetPath() << " | "
00063 << "Dateigröße: " << iter->GetSize() << " Byte | "
00064 << "Aenderungsdatum: " << iter->GetDateChanged() <<endl;
00065 }
00066
00067 }
00068
00069 void printout2( Dedupe::FileSearch::FileStream output )
00070 {
00071
00072 for(Dedupe::FileSearch::FileStream::iterator iter=output.begin();
00073 iter!=output.end();
00074 iter++)
00075 {
00076 cout << "Pfad: " << iter->GetPath() << " | "
00077 << "Dateityp: " << return_typ( iter->GetType() ) << " | "
00078 << "Existierend: " << return_bool( iter->GetExisting() ) << " | "
00079 << "Lesbar: " << return_bool( iter->GetReadable() ) <<endl;
00080 }
00081
00082 }
00083
00084 std::string return_typ( short typ )
00085 {
00086 if( typ == Dedupe::FileInfo::TFile ) return "Datei";
00087 if( typ == Dedupe::FileInfo::TDirectory ) return "Verzeichnis";
00088 if( typ == Dedupe::FileInfo::TSocket ) return "Socket";
00089 if( typ == Dedupe::FileInfo::TBlockDevice ) return "BlockDevice";
00090 if( typ == Dedupe::FileInfo::TCharDevice ) return "CharDevice";
00091 if( typ == Dedupe::FileInfo::TFifo ) return "FIFO";
00092 if( typ == Dedupe::FileInfo::TSymbolicLink ) return "SymLink";
00093 if( typ == Dedupe::FileInfo::TNotDefined ) return "Unbekannter Dateityp";
00094 }
00095
00096 std::string return_bool( bool jn )
00097 {
00098 if( jn = true ) return "Ja";
00099 if( jn = false ) return "Nein";
00100 }