dagolden / Path-Tiny

File path utility
41 stars 59 forks source link

wishlist: support for recursive 'copy' support #207

Open karenetheridge opened 6 years ago

karenetheridge commented 6 years ago

Currently, calling $path->copy on a directory results in: copy failed for ... to ...: Is a directory. It would be great to have support for copying directories, as a number of high-river distributions are using a module to do this that may not be suitable for such a high river position.

Possibly File::Copy::Recursive::Reduced could be used for this. There may be alternatives.

karenetheridge commented 6 years ago

I think we should seriously consider writing our own, or putting such functionality into File::Copy. It may be as simple as: use File::Path::mktree to create the directory structure; walk the tree and copy (using File::Copy::copy?) each file from src to dest.

(File::Copy::Recursive uses Path::Tiny (although it really shouldn't), so we simply cannot just use FCR in Path::Tiny to get this functionality.)

xdg commented 6 years ago

This is related to #58 and #22. Directory copies also need to consider a follow_symlinks option. Possibly, in the case of a directory we use the iterator method. As that is breadth first, there's an opportunity to create directories as we go before getting to their children.

ap commented 1 year ago

This was also posted over at RT as #146593.