I am already using below command to copy files from a specific date.
Previously I used this command and it worked well but now it was showing an error:
-bash: /bin/cp: Argument list too long
Commends used:
cd /share/new/
cp `find . -type f -newermt '16 july 2018'` /share/test
I need to copy all files in the folder "new" from July 20th to today date. How can I achieve this?
Best Answer
Don't use
cp
directly with the output offind
.It might passes way many too files in a single step (and that's why you get the error
Argument list too long
).Use the
-exec
parameter offind
, which execute the given command passing a every matched file tocp
, one at a time: