Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wild stab at fixing overlapping renames ...
Taking a list of files in an otherwise empty directory like: 01.txt 02.txt 03.txt And making it into: 02.txt 03.txt 04.txt Will naively create these operations: mv 01.txt 02.txt mv 02.txt 03.txt mv 03.txt 04.txt And since they are performed in order, the final directory state will contain a single file, 04.txt, which will be the 01.txt from the original list. This is not the most likely intention. Performing the operations in the reverse order would result in the most likely, desired outcome. However, more complext situations could arise where files are renamed in an arbitrary order that would not be handled in a naive pass either forward or backward. The solution here is a loop that tries until there are 2 passes across the list of operations in which no files are renamed. Ideally this would be tested for ahead of time instead of leaving the directory in an intermediate state. But that would exceed "wild stab" level of implementation. :)
- Loading branch information