You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For renaming nested files/folders, find(1) has a -depth option which traverses the file-system in a depth-first order in order to avoid trying to rename an item in an already renamed folder:
# Rename all files and folders containing "_foo" by replacing "_foo" -> "_bar"
find . -iname _foo -depth -exec rename _foo _bar '{}'\;
The readme currently carries the following note about deleting files:
There are scenarios where using fd … -X rm -r can cause race conditions: if you have a path like …/foo/bar/foo/… and want to remove all directories named foo, you can end up in a situation where the outer foo directory is removed first, leading to (harmless) "'foo/bar/foo': No such file or directory" errors in the rm call.
If this option was implemented, it seems like the note could be replaced with a recommendation to use fd … --depth -X rm -r.
First of all thanks for a great tool!
For renaming nested files/folders,
find(1)
has a-depth
option which traverses the file-system in a depth-first order in order to avoid trying to rename an item in an already renamed folder:Any chance of having a similar option for
fd
?See: https://man7.org/linux/man-pages/man1/find.1.html#EXPRESSION
I've seen that there has been some discussion about breadth first/depth first traversal already - thank you for your consideration.
The text was updated successfully, but these errors were encountered: