I'm trying to delete empty directories from Azure storage container which mounted to my DBFS
I'm able to list all directories which has no files.
%sh
find /dbfs/mnt/test/logs/2021 -empty -type d
Result :
/dbfs/mnt/test/logs/2021/02/12
/dbfs/mnt/test/logs/2021/02/15
/dbfs/mnt/test/logs/2021/02/16
But when I try to delete them, it is failing with Resource temporary unavailable.
%sh
find /dbfs/mnt/test/logs/ -type d -exec rmdir {} \;
Result:
rmdir: failed to remove '/dbfs/mnt/test/logs/': Directory not empty
rmdir: failed to remove '/dbfs/mnt/test/logs/2021': Directory not empty
rmdir: failed to remove '/dbfs/mnt/test/logs/2021/02': Directory not empty
rmdir: failed to remove '/dbfs/mnt/test/logs/2021/02/12': Resource temporarily unavailable
I'm able to successfully remove files older than certain days.. removing direcotry is not working. (Below command to remove files working
%sh
find /dbfs/mnt/test/logs/ -name "*.log" -type f -mtime +5 -exec rm -f {} \;