ldiff.cpp 614 B

12345678910111213141516171819202122232425
  1. // vim: sw=4 ts=4
  2. // эта программа выводит все ссылки из файла links.txt, соответствующие
  3. // которым файлы не скачаны
  4. //
  5. // применение:
  6. // $ ./ldiff links.txt | wget2 -ci-
  7. #include <filesystem>
  8. #include <fstream>
  9. #include <iostream>
  10. int main(int argc, const char* argv[])
  11. {
  12. if (argc < 1)
  13. return 1;
  14. std::ifstream file(argv[1]);
  15. for (std::string line; getline(file, line);)
  16. if (!std::filesystem::exists(line.substr(line.rfind('/') + 1)))
  17. std::cout << line << std::endl;
  18. file.close();
  19. }