/bin/sh: /bin/cp: Argument list too long

cpdirectoryfind

I have problem with this command:

 'cp' -fr /www/*-aws/* /www/mainhost/aws/awstatstotals/tmp/

Error is Argument list too long – I know many /www/-aws/ folders. I know that I can use FIND command, but I dont know how I can give two wildcard as folder paramater. Can you help me please?

Thank you Pavel

Best Answer

Don't put wildcards in the folder parameter. Put them in the path parameter.

find /www -maxdepth 2 -path '*-aws/*' -exec cp -frt /www/mainhost/aws/awstatstotals/tmp/ {} +
Related Topic