Sample Header Ad - 728x90

smbclient deltree with read-only directories

0 votes
1 answer
225 views
I'm trying to delete files on a NetApp server using smbclient //servername/share -c "deltree directory_to_delete". It works except for folders which have the read-only flag set. In this case, the command aborts with NT_STATUS_CANNOT_DELETE. I can view the flags with smbclient //servername/share -c "ls directory_to_delete/*" and remove them with smbclient //servername/share -c "setmode directory_to_delete/subdir_with_ro_flag -r", but only per directory. Is there a way to automate this (remove the read-only flag recursively) or any other way how to recursively delete a directory with read-only subdirectories? Btw. the Windows explorer does not complain when deleting such directories (using the same credentials). I'm sure it removes the ro-flag silently.
Asked by Schorschii (41 rep)
Mar 5, 2024, 06:17 PM
Last activity: Mar 11, 2024, 11:39 AM