2025-09-01 01:51:33 -05:00
|
|
|
#include "mfm_options.hpp"
|
|
|
|
|
|
2025-09-01 13:41:00 -05:00
|
|
|
#include "str.hpp"
|
2025-09-01 01:51:33 -05:00
|
|
|
|
|
|
|
|
#include "fmt/core.h"
|
|
|
|
|
|
2025-09-01 13:41:00 -05:00
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-01 01:51:33 -05:00
|
|
|
namespace fs = std::filesystem;
|
|
|
|
|
|
|
|
|
|
namespace mfm
|
|
|
|
|
{
|
|
|
|
|
void dup(const Opts::Dup &opts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
mfm::dup(const Opts::Dup &opts_)
|
|
|
|
|
{
|
|
|
|
|
if(fs::is_regular_file(opts_.path))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if(fs::is_directory(opts_.path))
|
|
|
|
|
{
|
|
|
|
|
auto dir_opts = (fs::directory_options::follow_directory_symlink |
|
|
|
|
|
fs::directory_options::skip_permission_denied);
|
|
|
|
|
|
|
|
|
|
for(const fs::directory_entry &de :
|
|
|
|
|
fs::recursive_directory_iterator(opts_.path,dir_opts))
|
|
|
|
|
{
|
2025-09-01 13:42:20 -05:00
|
|
|
fmt::println("{} {}",
|
|
|
|
|
opts_.path.string(),
|
|
|
|
|
de.path().string());
|
2025-09-01 13:43:21 -05:00
|
|
|
if(!str::startswith(de.path().filename().string(),".dup_"))
|
2025-09-01 13:43:00 -05:00
|
|
|
continue;
|
|
|
|
|
|
2025-09-01 13:42:20 -05:00
|
|
|
continue;
|
2025-09-01 01:51:33 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw std::runtime_error("invalid file type");
|
|
|
|
|
}
|
|
|
|
|
}
|