I want to delete the empty folders in cobian backups. I tried the "Ignore Empty Directories", "never ignore empty folders for full backup", and "do not delete final directory if empty" but these don't delete the empty folders. I tried the commands rd and rmdir on folder and get access denied. I reset ownership to myself and gave full control of folder but still get "access denied". Strangely, I can easily delete the folder from windows file explorer and if I make a new folder thru file explorer the RD command will delete those folders so its an ownership/access issue. I repeat, ownership was changed but RD cannot delete empty folders created by cobian but can delete folders I created in same directory.
Commands like this does not work(batch file):
@echo off
for /f "delims=" %%d in ('dir %1 /s /b /ad ^| sort /r') do rd "%%d"
No error messages.
I currently am using a work around:
robocopy d:\backup d:\backup /s /move
I'm moving the files in-place - source and destination are the same - and the "/s" switch deletes the empty folders in the process. It works but it is a weird solution. Ontop of which to hide the window while the batch file is working, I converted the batch file(.bat) into an executable(.exe) by a freeware(Advanced bat to exe convertor) that can create a hidden window.
So to recape;
Cannot delete empty folders from commandline using RD
cobian settings to ignore empty folders doesn't work
Folders can be deleted by explorer
folders can be deleted by robocopy
I would much rather have cobian remove these empty folders automatically.
Commands like this does not work(batch file):
@echo off
for /f "delims=" %%d in ('dir %1 /s /b /ad ^| sort /r') do rd "%%d"
No error messages.
I currently am using a work around:
robocopy d:\backup d:\backup /s /move
I'm moving the files in-place - source and destination are the same - and the "/s" switch deletes the empty folders in the process. It works but it is a weird solution. Ontop of which to hide the window while the batch file is working, I converted the batch file(.bat) into an executable(.exe) by a freeware(Advanced bat to exe convertor) that can create a hidden window.
So to recape;
Cannot delete empty folders from commandline using RD
cobian settings to ignore empty folders doesn't work
Folders can be deleted by explorer
folders can be deleted by robocopy
I would much rather have cobian remove these empty folders automatically.
Statistics: Posted by chiuchimu — 30 Apr 2023, 22:44 — Replies 1 — Views 5