Wednesday 8 April 2015

If you want to copy huge number of files from one directory to another directory using linux command

If you want to copy huge number of files from one directory to another directory using cp command. It  won’t work and shows a warning like '-bash: /bin/ls: Argument list too long'.

In that case we can use find command to copy files from one directory to another directory as below,


find <<sourceDirectory>> -name "<<regularExpression>>" -exec cp {} <<DestinationDirectory>> \;

No comments:

Post a Comment