new files for crawler and model

This commit is contained in:
Damien 2025-02-22 07:00:19 -05:00
parent 620eadf1b8
commit 76ac38e4c1
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,16 @@
use models::folder_data::FolderData;
use std::fs;
use std::path::PathBuf;
fn crawl(path: PathBuf) -> FolderData {
/*initialize mutable variables for tracking information about the folder.*/
let mut size = 0; // Total size of all the files and subfolders in the folder.
let mut subfolder_count = 0; // Total number of subfolders in the folder.
let mut file_count = 0; // Total number of files in the folder.
let mut children = Vec::new(); // Vector to store the child folder data
if let Ok(entries) = fs::read_dir(&path) {
}
}

View File

@ -0,0 +1,13 @@
use serde::Serialize;
#[derive(Serialize)]
struct FolderData {
name: String,
path: String,
#[serde(rename = "type")]
folder_type: String, // Always "folder" in this case
size: u64,
subfolders: usize,
children: Vec<FolderData>,
}