Skip to main content

file_storage/op/folder/delete_files/
delete_files.rs

1use crate::system::LocalPath;
2use crate::Operation::DeleteFiles;
3use crate::Reason::UnknownFileSystem;
4use crate::{Error, FolderPath};
5
6impl FolderPath {
7    //! Delete Files
8
9    /// Deletes all files in the folder recursively.
10    pub fn delete_files(&self) -> Result<(), Error> {
11        if let Some(path) = LocalPath::new(self.path()) {
12            return path.delete_files();
13        }
14
15        #[cfg(feature = "r2")]
16        if let Some(path) = crate::R2Path::new(self.path()) {
17            return path.delete_files();
18        }
19
20        Err(Error::new(self.clone(), DeleteFiles, UnknownFileSystem))
21    }
22}