first commit

This commit is contained in:
2025-11-12 22:28:12 +00:00
commit 42535a81b2
9 changed files with 1846 additions and 0 deletions

28
src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
use bollard::Docker;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let backup_root_folder = std::env::var("BACKUP_FOLDER")?;
let backup_root_path = std::path::Path::new(&backup_root_folder);
let folders = list_folders(backup_root_path).await?;
let docker_conn = Docker::connect_with_socket_defaults()?;
let docker_version = docker_conn.version().await?;
println!("Docker version: {:?}", docker_version);
Ok(())
}
async fn list_folders(path: &std::path::Path) -> anyhow::Result<Vec<std::path::PathBuf>> {
let mut folders = Vec::new();
let mut dir_entries = tokio::fs::read_dir(path).await?;
while let Some(entry) = dir_entries.next_entry().await? {
let file_type = entry.file_type().await?;
if file_type.is_dir() {
folders.push(entry.path());
}
}
Ok(folders)
}