|
|
|
|
@ -1,24 +1,25 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include <boost/filesystem.hpp>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#define K_VISION_DIR "/hard/k_vision"
|
|
|
|
|
#define AI_VISION_DIR "/hard/ai_vision"
|
|
|
|
|
|
|
|
|
|
namespace fs = boost::filesystem;
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> get_file_names(const std::string& strDir)
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> vs;
|
|
|
|
|
std::filesystem::path path(strDir);
|
|
|
|
|
if (!std::filesystem::exists(path))
|
|
|
|
|
fs::path path(strDir);
|
|
|
|
|
if (!fs::exists(path))
|
|
|
|
|
{
|
|
|
|
|
return vs;
|
|
|
|
|
}
|
|
|
|
|
std::filesystem::directory_iterator dir_iter(path);
|
|
|
|
|
fs::directory_iterator dir_iter(path);
|
|
|
|
|
for (auto it:dir_iter)
|
|
|
|
|
{
|
|
|
|
|
if (it.is_regular_file() && it.exists())
|
|
|
|
|
if (fs::is_regular_file(it) && fs::exists(it))
|
|
|
|
|
{
|
|
|
|
|
vs.push_back(it.path().filename().string());
|
|
|
|
|
}
|
|
|
|
|
@ -29,15 +30,15 @@ std::vector<std::string> get_file_names(const std::string& strDir)
|
|
|
|
|
std::vector<std::string> get_file_paths(const std::string& strDir)
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> vs;
|
|
|
|
|
std::filesystem::path path(strDir);
|
|
|
|
|
if (!std::filesystem::exists(path))
|
|
|
|
|
fs::path path(strDir);
|
|
|
|
|
if (!fs::exists(path))
|
|
|
|
|
{
|
|
|
|
|
return vs;
|
|
|
|
|
}
|
|
|
|
|
std::filesystem::directory_iterator dir_iter(path);
|
|
|
|
|
fs::directory_iterator dir_iter(path);
|
|
|
|
|
for (auto it:dir_iter)
|
|
|
|
|
{
|
|
|
|
|
if (it.is_regular_file() && it.exists())
|
|
|
|
|
if (fs::is_regular_file(it) && fs::exists(it))
|
|
|
|
|
{
|
|
|
|
|
vs.push_back(it.path().string());
|
|
|
|
|
}
|
|
|
|
|
@ -129,7 +130,7 @@ int main(int argc, char* argv[]) {
|
|
|
|
|
char szSaveDir[255];
|
|
|
|
|
snprintf(szSaveDir, sizeof (szSaveDir), "%s/%d%02d%02d/",
|
|
|
|
|
AI_VISION_DIR, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
|
|
|
|
std::filesystem::create_directories(szSaveDir);
|
|
|
|
|
fs::create_directories(szSaveDir);
|
|
|
|
|
auto vec_file_name = get_file_names(K_VISION_DIR);
|
|
|
|
|
if (vec_file_name.empty())
|
|
|
|
|
{
|
|
|
|
|
@ -162,14 +163,11 @@ int main(int argc, char* argv[]) {
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (auto it:vec_matched_path)
|
|
|
|
|
{
|
|
|
|
|
std::filesystem::path path(it);
|
|
|
|
|
fs::path path(it);
|
|
|
|
|
auto strName = path.filename().string();
|
|
|
|
|
std::string strPath = std::string(szSaveDir) + "/" + strName;
|
|
|
|
|
bool bRet = std::filesystem::copy_file(it,strName,std::filesystem::copy_options::overwrite_existing);
|
|
|
|
|
if (bRet)
|
|
|
|
|
{
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
fs::copy_file(it,strName,fs::copy_option::overwrite_if_exists);
|
|
|
|
|
++i;
|
|
|
|
|
if (i % 50 == 0)
|
|
|
|
|
{
|
|
|
|
|
std::cout << "info: copy progress " << i << "/" << vec_matched_path.size() << std::endl;
|
|
|
|
|
|