Prathamesh Chavan <pc44800@xxxxxxxxx> writes: > Thanks for pointing out that we can introduce the flag REMOVE_DIR_KEEP_TOPLEVEL > which solves the issue. And for the case where no directory exists: we > create an empty > directory.Since this won't be similar to what happens in the shell > script, this change > can be included in a saperate patch as an imporvement. Exactly. The way the shell script does it is to _always_ honor user's umask and recreate the directory, so before that separate improvement, tweaking "mode" based on the returned value from an extra lstat() is an unneeded change of behaviour. Just passing 0777 and let mkdir() take the umask into account to come up with the final permission bits is more in line with the original scripted version, I would think. Thanks.