In directory /source
I'd like to copy all files with a file name more than 15 characters to directory /dest
. Is there a UNIX command to do this?
EDIT: Although this question explains how to search for a filename of a certain length, my question also asks how to copy the file.
Best Answer
You can make a pattern with 16-or-more characters and copy those files.
A simple (but not elegant) approach, using 16
?
characters, each matching any single character:After the 16th
?
, use*
to match any number of characters. The pattern might not really match anything, so a test-f
to ensure it is a file is still needed.