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.
mount -t cifs //servername/share …) an option so that you can userm -rf, rather than usingsmbclient?smbclientcommand is part of a script which I don't want to rewrite if there is an other solution.