Copy files from one folder to another folder within specific date range
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
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?
command-line bash copy
add a comment |Â
up vote
2
down vote
favorite
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?
command-line bash copy
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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?
command-line bash copy
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?
command-line bash copy
command-line bash copy
edited 18 mins ago


Videonauth
22.4k116897
22.4k116897
asked 21 mins ago
Venki
204
204
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
Don't use cp
directly with the output of find
.
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 of find
, which execute the given command passing a every matched file to cp
, one at a time:
cd /share/new/
find . -type f -newermt '16 july 2018' -exec cp /share/test ;
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you typefind . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last;
, too.
– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
add a comment |Â
up vote
3
down vote
use find -exec
:
find /share/new/ -type f -newermt '16 july 2018' -exec cp /share/test ;
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the;
at the end.
– RoVo
6 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Don't use cp
directly with the output of find
.
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 of find
, which execute the given command passing a every matched file to cp
, one at a time:
cd /share/new/
find . -type f -newermt '16 july 2018' -exec cp /share/test ;
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you typefind . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last;
, too.
– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
add a comment |Â
up vote
3
down vote
accepted
Don't use cp
directly with the output of find
.
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 of find
, which execute the given command passing a every matched file to cp
, one at a time:
cd /share/new/
find . -type f -newermt '16 july 2018' -exec cp /share/test ;
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you typefind . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last;
, too.
– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Don't use cp
directly with the output of find
.
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 of find
, which execute the given command passing a every matched file to cp
, one at a time:
cd /share/new/
find . -type f -newermt '16 july 2018' -exec cp /share/test ;
Don't use cp
directly with the output of find
.
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 of find
, which execute the given command passing a every matched file to cp
, one at a time:
cd /share/new/
find . -type f -newermt '16 july 2018' -exec cp /share/test ;
answered 16 mins ago
Mr Shunz
1,9361319
1,9361319
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you typefind . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last;
, too.
– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
add a comment |Â
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you typefind . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last;
, too.
– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
find: missing argument to `-exec'
– Venki
12 mins ago
find: missing argument to `-exec'
– Venki
12 mins ago
@Venki if you type
find . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last ;
, too.– Mr Shunz
7 mins ago
@Venki if you type
find . -type f -newermt '16 july 2018'
does any results appear? It might be that no files match your query. Pay attention to the last ;
, too.– Mr Shunz
7 mins ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
– Venki
1 min ago
add a comment |Â
up vote
3
down vote
use find -exec
:
find /share/new/ -type f -newermt '16 july 2018' -exec cp /share/test ;
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the;
at the end.
– RoVo
6 mins ago
add a comment |Â
up vote
3
down vote
use find -exec
:
find /share/new/ -type f -newermt '16 july 2018' -exec cp /share/test ;
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the;
at the end.
– RoVo
6 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
use find -exec
:
find /share/new/ -type f -newermt '16 july 2018' -exec cp /share/test ;
use find -exec
:
find /share/new/ -type f -newermt '16 july 2018' -exec cp /share/test ;
answered 17 mins ago
RoVo
5,6341237
5,6341237
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the;
at the end.
– RoVo
6 mins ago
add a comment |Â
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the;
at the end.
– RoVo
6 mins ago
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
getting same error for your command also find: missing argument to `-exec'
– Venki
9 mins ago
I think your missing the
;
at the end.– RoVo
6 mins ago
I think your missing the
;
at the end.– RoVo
6 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1078245%2fcopy-files-from-one-folder-to-another-folder-within-specific-date-range%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password