Skip to content

General tips

Clayton T. Morrison edited this page Sep 19, 2021 · 2 revisions

Copy large numbers of individual files

When copying very large numbers of files, e.g., hundreds of thousands, methods like cp may exceed built-in unix limits in the number of files being managed (resulting in errors like Argument list too long).

In this case, you can use find to execute commands incrementally, following this pattern:

find . -maxdepth 1 -name "<filename_pattern>" -exec cp {} <target_directory> \;