trying to get script in linux console to show duplicate file names instead of an error
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am trying to write a script that is to be ran in the console in linux.
It is to look for .jpeg files within a directory and then copy them to a directory called jpegs.
I need to get it to show me the duplicate filenames but only list the duplicate file name once in the list produced (so it doesnt show the same name twice), instead of just showing me the error.
Can anyone help me with how to get this working?
This is the script I have so far:
#!/bin/sh
if ! mkdir jpegs 2> /dev/null
then
echo " Cannot create directory "jpegs" perhaps it already exists."
echo " delete the directory and try again."
exit
fi
for srcpath in $(find fs282/mirror -iname "*.jpg")
do
cp --backup $srcpath jpegs/
done
echo "List of Duplicate Files Follows"
linux scripting console
New contributor
add a comment |Â
up vote
0
down vote
favorite
I am trying to write a script that is to be ran in the console in linux.
It is to look for .jpeg files within a directory and then copy them to a directory called jpegs.
I need to get it to show me the duplicate filenames but only list the duplicate file name once in the list produced (so it doesnt show the same name twice), instead of just showing me the error.
Can anyone help me with how to get this working?
This is the script I have so far:
#!/bin/sh
if ! mkdir jpegs 2> /dev/null
then
echo " Cannot create directory "jpegs" perhaps it already exists."
echo " delete the directory and try again."
exit
fi
for srcpath in $(find fs282/mirror -iname "*.jpg")
do
cp --backup $srcpath jpegs/
done
echo "List of Duplicate Files Follows"
linux scripting console
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to write a script that is to be ran in the console in linux.
It is to look for .jpeg files within a directory and then copy them to a directory called jpegs.
I need to get it to show me the duplicate filenames but only list the duplicate file name once in the list produced (so it doesnt show the same name twice), instead of just showing me the error.
Can anyone help me with how to get this working?
This is the script I have so far:
#!/bin/sh
if ! mkdir jpegs 2> /dev/null
then
echo " Cannot create directory "jpegs" perhaps it already exists."
echo " delete the directory and try again."
exit
fi
for srcpath in $(find fs282/mirror -iname "*.jpg")
do
cp --backup $srcpath jpegs/
done
echo "List of Duplicate Files Follows"
linux scripting console
New contributor
I am trying to write a script that is to be ran in the console in linux.
It is to look for .jpeg files within a directory and then copy them to a directory called jpegs.
I need to get it to show me the duplicate filenames but only list the duplicate file name once in the list produced (so it doesnt show the same name twice), instead of just showing me the error.
Can anyone help me with how to get this working?
This is the script I have so far:
#!/bin/sh
if ! mkdir jpegs 2> /dev/null
then
echo " Cannot create directory "jpegs" perhaps it already exists."
echo " delete the directory and try again."
exit
fi
for srcpath in $(find fs282/mirror -iname "*.jpg")
do
cp --backup $srcpath jpegs/
done
echo "List of Duplicate Files Follows"
linux scripting console
linux scripting console
New contributor
New contributor
New contributor
asked 8 mins ago
ESuth
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
ESuth is a new contributor. Be nice, and check out our Code of Conduct.
ESuth is a new contributor. Be nice, and check out our Code of Conduct.
ESuth is a new contributor. Be nice, and check out our Code of Conduct.
ESuth is a new contributor. Be nice, and check out our Code of Conduct.
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%2funix.stackexchange.com%2fquestions%2f479793%2ftrying-to-get-script-in-linux-console-to-show-duplicate-file-names-instead-of-an%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