Copy files from one folder to another folder within specific date range

Clash Royale CLAN TAG#URR8PPP
up vote
4
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
4
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
4
down vote
favorite
up vote
4
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 Sep 25 at 9:08
Videonauth
22.6k116898
22.6k116898
asked Sep 25 at 9:05
Venki
305
305
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
9
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 ;
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).
â Ian Emnace
Sep 25 at 17:51
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the-tswitch, rather than by syntax, and making use of+which constructs an argument list, iefind <tests> -exec cp -t /share/test +The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launchingcpn times where n is the number of files...
â Zanna
Sep 25 at 17:58
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
 |Â
show 4 more comments
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
Sep 25 at 9:18
I think your missing the;at the end.
â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
add a comment |Â
up vote
0
down vote
Make use of the -exec action of find and the -t option of cp; I also recommend the -i or -n options if you donâÂÂt want to overwrite identically named files by accident:
find ... -exec cp -i -t TARGET -- +
The other current answers spawn a cp child process for every matching file while this answer only spawns as many as necessary based on the total program argument length limit (see below) which will make a big difference once you reach a couple of thousand matches which appears to be your case.
From the find(1) manual:
-exec command ;â Execute command [â¦]. All following arguments to find are taken to be arguments to the command until an argument consisting of;is encountered. The stringis replaced by the current file name being processed everywhere it occurs in the arguments to the command [â¦]. The specified command is run once for each matched file. [â¦]
-exec command +â This variant of the-execaction runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. [â¦]
From the cp(1) manual:
-t,--target-directory=DIRECTORYâ copy all SOURCE arguments into DIRECTORY
-i,--interactiveâ prompt before overwrite
-n,--no-clobberâ do not overwrite an existing file
add a comment |Â
up vote
-1
down vote
You should try this syntax:
find /share/new/ -type f -newermt '16 july 2018' -exec cp -R /share/test/ ;
2
What is the purpose of the-Rhere? Doesn't it recursively copy/share/testto all the files found? That seems wrong.
â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a$source_fileto a$target_directory. The command you propose instead recursively copies the$target_directoryto the$source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we runcp -R /source/directory /target/filethen we getcp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.
â PerlDuck
Sep 26 at 8:33
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
9
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 ;
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).
â Ian Emnace
Sep 25 at 17:51
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the-tswitch, rather than by syntax, and making use of+which constructs an argument list, iefind <tests> -exec cp -t /share/test +The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launchingcpn times where n is the number of files...
â Zanna
Sep 25 at 17:58
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
 |Â
show 4 more comments
up vote
9
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 ;
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).
â Ian Emnace
Sep 25 at 17:51
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the-tswitch, rather than by syntax, and making use of+which constructs an argument list, iefind <tests> -exec cp -t /share/test +The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launchingcpn times where n is the number of files...
â Zanna
Sep 25 at 17:58
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
 |Â
show 4 more comments
up vote
9
down vote
accepted
up vote
9
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 ;
edited Sep 25 at 18:35
vanadium
2,5641721
2,5641721
answered Sep 25 at 9:11
Mr Shunz
2,1121320
2,1121320
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).
â Ian Emnace
Sep 25 at 17:51
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the-tswitch, rather than by syntax, and making use of+which constructs an argument list, iefind <tests> -exec cp -t /share/test +The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launchingcpn times where n is the number of files...
â Zanna
Sep 25 at 17:58
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
 |Â
show 4 more comments
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).
â Ian Emnace
Sep 25 at 17:51
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the-tswitch, rather than by syntax, and making use of+which constructs an argument list, iefind <tests> -exec cp -t /share/test +The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launchingcpn times where n is the number of files...
â Zanna
Sep 25 at 17:58
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
1
1
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
its working :: "" find . -type f -newermt '16 july 2018' -exec cp /share/test/ ; "" missing "/" after test because test is a directory
â Venki
Sep 25 at 9:26
1
1
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
I added quotes to the "". This will make sure files with names containing spaces are handled correctly.
â vanadium
Sep 25 at 10:22
4
4
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;
is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).â Ian Emnace
Sep 25 at 17:51
@vanadium find's -exec executes the program directly. It doesn't invoke a shell;
is replaced with the filename as a single argument regardless of quoting (which find never actually sees, anyway).â Ian Emnace
Sep 25 at 17:51
3
3
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the
-t switch, rather than by syntax, and making use of + which constructs an argument list, ie find <tests> -exec cp -t /share/test + The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launching cp n times where n is the number of files...â Zanna
Sep 25 at 17:58
You can improve the efficiency of this command (which probably matters if OP is getting "argument list too long") by specifying the destination explicitly with the
-t switch, rather than by syntax, and making use of + which constructs an argument list, ie find <tests> -exec cp -t /share/test + The argument list is broken as many times as needed to complete without exceeding the limit. This avoids launching cp n times where n is the number of files...â Zanna
Sep 25 at 17:58
1
1
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
@IanEmnace Thank! Removed the quotes again, not needed indeed!
â vanadium
Sep 25 at 18:36
 |Â
show 4 more comments
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
Sep 25 at 9:18
I think your missing the;at the end.
â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
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
Sep 25 at 9:18
I think your missing the;at the end.
â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
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 Sep 25 at 9:09
RoVo
5,8391438
5,8391438
getting same error for your command also find: missing argument to `-exec'
â Venki
Sep 25 at 9:18
I think your missing the;at the end.
â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
add a comment |Â
getting same error for your command also find: missing argument to `-exec'
â Venki
Sep 25 at 9:18
I think your missing the;at the end.
â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
getting same error for your command also find: missing argument to `-exec'
â Venki
Sep 25 at 9:18
getting same error for your command also find: missing argument to `-exec'
â Venki
Sep 25 at 9:18
I think your missing the
; at the end.â RoVo
Sep 25 at 9:20
I think your missing the
; at the end.â RoVo
Sep 25 at 9:20
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
test is a directory i am missing / after test
â Venki
Sep 25 at 9:31
add a comment |Â
up vote
0
down vote
Make use of the -exec action of find and the -t option of cp; I also recommend the -i or -n options if you donâÂÂt want to overwrite identically named files by accident:
find ... -exec cp -i -t TARGET -- +
The other current answers spawn a cp child process for every matching file while this answer only spawns as many as necessary based on the total program argument length limit (see below) which will make a big difference once you reach a couple of thousand matches which appears to be your case.
From the find(1) manual:
-exec command ;â Execute command [â¦]. All following arguments to find are taken to be arguments to the command until an argument consisting of;is encountered. The stringis replaced by the current file name being processed everywhere it occurs in the arguments to the command [â¦]. The specified command is run once for each matched file. [â¦]
-exec command +â This variant of the-execaction runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. [â¦]
From the cp(1) manual:
-t,--target-directory=DIRECTORYâ copy all SOURCE arguments into DIRECTORY
-i,--interactiveâ prompt before overwrite
-n,--no-clobberâ do not overwrite an existing file
add a comment |Â
up vote
0
down vote
Make use of the -exec action of find and the -t option of cp; I also recommend the -i or -n options if you donâÂÂt want to overwrite identically named files by accident:
find ... -exec cp -i -t TARGET -- +
The other current answers spawn a cp child process for every matching file while this answer only spawns as many as necessary based on the total program argument length limit (see below) which will make a big difference once you reach a couple of thousand matches which appears to be your case.
From the find(1) manual:
-exec command ;â Execute command [â¦]. All following arguments to find are taken to be arguments to the command until an argument consisting of;is encountered. The stringis replaced by the current file name being processed everywhere it occurs in the arguments to the command [â¦]. The specified command is run once for each matched file. [â¦]
-exec command +â This variant of the-execaction runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. [â¦]
From the cp(1) manual:
-t,--target-directory=DIRECTORYâ copy all SOURCE arguments into DIRECTORY
-i,--interactiveâ prompt before overwrite
-n,--no-clobberâ do not overwrite an existing file
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Make use of the -exec action of find and the -t option of cp; I also recommend the -i or -n options if you donâÂÂt want to overwrite identically named files by accident:
find ... -exec cp -i -t TARGET -- +
The other current answers spawn a cp child process for every matching file while this answer only spawns as many as necessary based on the total program argument length limit (see below) which will make a big difference once you reach a couple of thousand matches which appears to be your case.
From the find(1) manual:
-exec command ;â Execute command [â¦]. All following arguments to find are taken to be arguments to the command until an argument consisting of;is encountered. The stringis replaced by the current file name being processed everywhere it occurs in the arguments to the command [â¦]. The specified command is run once for each matched file. [â¦]
-exec command +â This variant of the-execaction runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. [â¦]
From the cp(1) manual:
-t,--target-directory=DIRECTORYâ copy all SOURCE arguments into DIRECTORY
-i,--interactiveâ prompt before overwrite
-n,--no-clobberâ do not overwrite an existing file
Make use of the -exec action of find and the -t option of cp; I also recommend the -i or -n options if you donâÂÂt want to overwrite identically named files by accident:
find ... -exec cp -i -t TARGET -- +
The other current answers spawn a cp child process for every matching file while this answer only spawns as many as necessary based on the total program argument length limit (see below) which will make a big difference once you reach a couple of thousand matches which appears to be your case.
From the find(1) manual:
-exec command ;â Execute command [â¦]. All following arguments to find are taken to be arguments to the command until an argument consisting of;is encountered. The stringis replaced by the current file name being processed everywhere it occurs in the arguments to the command [â¦]. The specified command is run once for each matched file. [â¦]
-exec command +â This variant of the-execaction runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. [â¦]
From the cp(1) manual:
-t,--target-directory=DIRECTORYâ copy all SOURCE arguments into DIRECTORY
-i,--interactiveâ prompt before overwrite
-n,--no-clobberâ do not overwrite an existing file
edited Sep 26 at 2:19
answered Sep 26 at 2:13
David Foerster
26.6k1363106
26.6k1363106
add a comment |Â
add a comment |Â
up vote
-1
down vote
You should try this syntax:
find /share/new/ -type f -newermt '16 july 2018' -exec cp -R /share/test/ ;
2
What is the purpose of the-Rhere? Doesn't it recursively copy/share/testto all the files found? That seems wrong.
â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a$source_fileto a$target_directory. The command you propose instead recursively copies the$target_directoryto the$source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we runcp -R /source/directory /target/filethen we getcp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.
â PerlDuck
Sep 26 at 8:33
add a comment |Â
up vote
-1
down vote
You should try this syntax:
find /share/new/ -type f -newermt '16 july 2018' -exec cp -R /share/test/ ;
2
What is the purpose of the-Rhere? Doesn't it recursively copy/share/testto all the files found? That seems wrong.
â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a$source_fileto a$target_directory. The command you propose instead recursively copies the$target_directoryto the$source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we runcp -R /source/directory /target/filethen we getcp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.
â PerlDuck
Sep 26 at 8:33
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
You should try this syntax:
find /share/new/ -type f -newermt '16 july 2018' -exec cp -R /share/test/ ;
You should try this syntax:
find /share/new/ -type f -newermt '16 july 2018' -exec cp -R /share/test/ ;
edited Sep 25 at 18:01
Zanna
48.3k13120229
48.3k13120229
answered Sep 25 at 11:36
Rehan
73
73
2
What is the purpose of the-Rhere? Doesn't it recursively copy/share/testto all the files found? That seems wrong.
â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a$source_fileto a$target_directory. The command you propose instead recursively copies the$target_directoryto the$source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we runcp -R /source/directory /target/filethen we getcp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.
â PerlDuck
Sep 26 at 8:33
add a comment |Â
2
What is the purpose of the-Rhere? Doesn't it recursively copy/share/testto all the files found? That seems wrong.
â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a$source_fileto a$target_directory. The command you propose instead recursively copies the$target_directoryto the$source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we runcp -R /source/directory /target/filethen we getcp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.
â PerlDuck
Sep 26 at 8:33
2
2
What is the purpose of the
-R here? Doesn't it recursively copy /share/test to all the files found? That seems wrong.â PerlDuck
Sep 25 at 18:12
What is the purpose of the
-R here? Doesn't it recursively copy /share/test to all the files found? That seems wrong.â PerlDuck
Sep 25 at 18:12
Well, no. The OP wants to copy a
$source_file to a $target_directory. The command you propose instead recursively copies the $target_directory to the $source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we run cp -R /source/directory /target/file then we get cp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.â PerlDuck
Sep 26 at 8:33
Well, no. The OP wants to copy a
$source_file to a $target_directory. The command you propose instead recursively copies the $target_directory to the $source_file. This doesn't make sense. Not only the direction is just the other way round, but also when copying recursively, the target must be a directory, not a file. When we run cp -R /source/directory /target/file then we get cp: cannot overwrite non-directory 'target/file' with directory '/source/directory'.â PerlDuck
Sep 26 at 8:33
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