document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <string>
  4.  
  5. void print(std::string str)
  6. {
  7.     std::cout << str << std::endl;
  8. }
  9.  
  10. bool confirmExit()
  11. {
  12.     print("Exit y/n ?");
  13.     std::string confirm = "n";
  14.     std::cin >> confirm;
  15.     if(confirm.compare("y")==0)
  16.     {
  17.         return true;
  18.     }
  19.     else
  20.     {
  21.         return false;
  22.     }
  23. }
  24.  
  25. void search(std::string path)
  26. {
  27.     WIN32_FIND_DATA data;
  28.     HANDLE handle;
  29.     path = path+"\\\\";
  30.     std::string tPath = path+"*";
  31.     LPCSTR newPath = tPath.c_str();
  32.     handle = FindFirstFile(newPath,&data);
  33.     if(handle != INVALID_HANDLE_VALUE)
  34.     {
  35.         do
  36.         {
  37.             std::string filename = data.cFileName;
  38.             std::string filepath = path+filename;
  39.             if(filename.compare(".")==1 & filename.compare("..")==1)
  40.             {
  41.                 if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  42.                 {
  43.                     search(filepath);
  44.                 }
  45.                 else
  46.                 {
  47.                     print(filepath);
  48.                 }
  49.             }
  50.         }
  51.         while(FindNextFile(handle,&data));
  52.     }
  53.     else
  54.     {
  55.         print("Invalid path: "+(std::string) newPath);
  56.     }
  57. }
  58.  
  59.  
  60. void searchForm()
  61. {
  62.     print("Enter path to search: ");
  63.     std::string path = "C:";
  64.     std::cin >> std::noskipws >> path;
  65.     search(path);
  66. }
  67.  
  68. int main()
  69. {
  70.     searchForm();
  71.     while(!confirmExit())
  72.     {
  73.         searchForm();
  74.     }
  75.     return 0;
  76. }
');