-
Notifications
You must be signed in to change notification settings - Fork 111
Move strategy will delete empty dirs. #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Matej Dujava <[email protected]>
I see you've added two test files in Lines 195 to 210 in 183e423
The code that I wrote is not working exactly as expected. It deletes only the currently processed directory, but leaves the parent empty directory. Ideally the directories should be deleted right after all files are processed because in case of error in the process the processed directories will be already deleted. Do you have an idea how to implement it? |
…ving It is using function os.removedirs, which will remove as mach as it can from right side of path (even whole path, if its only one path in source dir). Signed-off-by: Matej Dujava <[email protected]>
Hello, |
To be honest that
and the input path is If I am I think the code should be changed to manually look for parent directory and stop if it reached the |
But if we run it like
it will delete We can truncate INPUTDIR path to only last portion ( |
I have some problems. On linux we can use dir_fd to act like we are in inputdir and then remove everything inside it (in unix philosophy we souldn't change working dir, in case of kill, our process should create core dump inside original cwd). But this dir_fd is not supported on Windows, so we probably need to change dir or do removing manualy in some loop. Is it ok to separate code if os supports dir_fd or should I create one universal code? |
I think one universal function is more predictable for cross platform. |
@mdujava do you have any updates? |
@mdujava, the code is obsolete and I will be closing this PR. If you want to update it to work with the latest release please submit a new PR and I will be more than happy to take a look. |
Hello,
This change adds feature mentioned in #20. After processing all files, it will walk dirs in reverse order and delete empty dirs.