mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-22 07:56:32 -05:00
mfm_dup.cpp
This commit is contained in:
parent
37f53c2873
commit
ff35f87a05
1 changed files with 22 additions and 19 deletions
|
|
@ -20,31 +20,34 @@ mfm::dup(const Opts::Dup &opts_)
|
|||
{
|
||||
std::vector<std::filesystem::path> paths;
|
||||
|
||||
paths = opts_.paths;
|
||||
|
||||
|
||||
if(fs::is_regular_file(opts_.path))
|
||||
for(const auto &path : paths)
|
||||
{
|
||||
}
|
||||
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))
|
||||
if(fs::is_regular_file(opts_.path))
|
||||
{
|
||||
if(!str::startswith(de.path().filename().string(),".dup_"))
|
||||
continue;
|
||||
}
|
||||
else if(fs::is_directory(opts_.path))
|
||||
{
|
||||
auto dir_opts = (fs::directory_options::follow_directory_symlink |
|
||||
fs::directory_options::skip_permission_denied);
|
||||
|
||||
for(const auto &de :
|
||||
fs::directory_iterator(de.path().parent_path()))
|
||||
for(const fs::directory_entry &de :
|
||||
fs::recursive_directory_iterator(opts_.path,dir_opts))
|
||||
{
|
||||
fmt::println("{}",de.path().filename().string());
|
||||
if(!str::startswith(de.path().filename().string(),".dup_"))
|
||||
continue;
|
||||
|
||||
for(const auto &de :
|
||||
fs::directory_iterator(de.path().parent_path()))
|
||||
{
|
||||
fmt::println("{}",de.path().filename().string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("invalid file type");
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("invalid file type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue