Files
authentik/website/scripts/docsmg/src/move.rs
Bama 59973d1f06 website/scripts: Add docsmg migration tool (#10658)
* add docsmg tool

* moved to the correct scripts directory

* removed test files
2024-07-26 15:54:41 -05:00

24 lines
667 B
Rust

use std::path::PathBuf;
use crate::recurse_directory;
pub fn r#move(old_path: PathBuf, new_path: PathBuf) {
let is_dir = old_path.is_dir();
if is_dir {
let paths = recurse_directory(old_path.clone());
for path in paths {
let raw_path = path
.strip_prefix(old_path.clone())
.expect("path to be within old path");
let new_path = new_path.join(raw_path);
println!("{} -> {}", path.display(), new_path.display());
}
} else {
println!(
"{} -> {}",
old_path.to_string_lossy(),
new_path.to_string_lossy()
);
}
}