@@ -1375,6 +1375,23 @@ impl Operator {
13751375
13761376 /// Remove the path and all nested dirs and files recursively.
13771377 ///
1378+ /// # Deprecated
1379+ ///
1380+ /// This method is deprecated since v0.55.0. Use [`Operator::delete_with`] with
1381+ /// `recursive(true)` instead.
1382+ ///
1383+ /// ## Migration Example
1384+ ///
1385+ /// Instead of:
1386+ /// ```ignore
1387+ /// op.remove_all("path/to/dir").await?;
1388+ /// ```
1389+ ///
1390+ /// Use:
1391+ /// ```ignore
1392+ /// op.delete_with("path/to/dir").recursive(true).await?;
1393+ /// ```
1394+ ///
13781395 /// # Notes
13791396 ///
13801397 /// If underlying services support delete in batch, we will use batch
@@ -1392,28 +1409,12 @@ impl Operator {
13921409 /// # Ok(())
13931410 /// # }
13941411 /// ```
1412+ #[ deprecated(
1413+ since = "0.55.0" ,
1414+ note = "Use `delete_with` with `recursive(true)` instead"
1415+ ) ]
13951416 pub async fn remove_all ( & self , path : & str ) -> Result < ( ) > {
1396- match self . stat ( path) . await {
1397- // If object exists.
1398- Ok ( metadata) => {
1399- // If the object is a file, we can delete it.
1400- if metadata. mode ( ) != EntryMode :: DIR {
1401- self . delete ( path) . await ?;
1402- // There may still be objects prefixed with the path in some backend, so we can't return here.
1403- }
1404- }
1405-
1406- // If dir not found, it may be a prefix in object store like S3,
1407- // and we still need to delete objects under the prefix.
1408- Err ( e) if e. kind ( ) == ErrorKind :: NotFound => { }
1409-
1410- // Pass on any other error.
1411- Err ( e) => return Err ( e) ,
1412- } ;
1413-
1414- let lister = self . lister_with ( path) . recursive ( true ) . await ?;
1415- self . delete_try_stream ( lister) . await ?;
1416- Ok ( ( ) )
1417+ self . delete_with ( path) . recursive ( true ) . await
14171418 }
14181419
14191420 /// List entries whose paths start with the given prefix `path`.
0 commit comments