create dirs + delete dirs + delete files

This commit is contained in:
2025-07-13 03:18:22 +02:00
parent 18be642181
commit b4731f6f81
53 changed files with 1056 additions and 59 deletions

View File

@@ -36,3 +36,21 @@ where
Ok(files)
}
pub async fn create_dir<P>(path: P) -> Result<()>
where
P: AsRef<Path>,
{
fs::create_dir(path).await?;
Ok(())
}
pub async fn delete_dir<P>(path: P) -> Result<()>
where
P: AsRef<Path>,
{
fs::remove_dir_all(path).await?;
Ok(())
}

14
backend/src/fs/file.rs Normal file
View File

@@ -0,0 +1,14 @@
use std::path::Path;
use tokio::fs;
use crate::Result;
pub async fn delete_file<P>(path: P) -> Result<()>
where
P: AsRef<Path>,
{
fs::remove_file(path).await?;
Ok(())
}

View File

@@ -1,9 +1,11 @@
mod dir;
mod file;
pub use dir::*;
pub use file::*;
use serde::Serialize;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Serialize)]
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FileType {
File,