How can I copy files with duplicate filenames into one directory and retain both files by having the...
On windows OS, when you copy a file into a directory that already has a file with that name, it asks you whether you want to:
- copy the file and replace/overwrite the existing one
- cancel copying the new file into the directory
- copy the file, but rename it (as something like "filename - copy (1)")
When I do this in Ubuntu, I don't have that 3rd option (which is a lot of times a very useful option). Is there any way to be able to do that in Ubuntu?
14.04 files
add a comment |
On windows OS, when you copy a file into a directory that already has a file with that name, it asks you whether you want to:
- copy the file and replace/overwrite the existing one
- cancel copying the new file into the directory
- copy the file, but rename it (as something like "filename - copy (1)")
When I do this in Ubuntu, I don't have that 3rd option (which is a lot of times a very useful option). Is there any way to be able to do that in Ubuntu?
14.04 files
add a comment |
On windows OS, when you copy a file into a directory that already has a file with that name, it asks you whether you want to:
- copy the file and replace/overwrite the existing one
- cancel copying the new file into the directory
- copy the file, but rename it (as something like "filename - copy (1)")
When I do this in Ubuntu, I don't have that 3rd option (which is a lot of times a very useful option). Is there any way to be able to do that in Ubuntu?
14.04 files
On windows OS, when you copy a file into a directory that already has a file with that name, it asks you whether you want to:
- copy the file and replace/overwrite the existing one
- cancel copying the new file into the directory
- copy the file, but rename it (as something like "filename - copy (1)")
When I do this in Ubuntu, I don't have that 3rd option (which is a lot of times a very useful option). Is there any way to be able to do that in Ubuntu?
14.04 files
14.04 files
edited Oct 19 '14 at 11:07
αғsнιη
24.1k2295155
24.1k2295155
asked Oct 19 '14 at 10:30
heisenbergman
168118
168118
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Unfortunately Nautilus doesn't have that option. You could try another file manager like Dolphin or you can use the command line program cp(1)
with the backup option:
cp --backup -t DESTINATION SOURCE [SOURCE...]
This has the following effects which can be controlled with other options as described in the manual page of cp(1)
:
--backup[=CONTROL]
― make a backup of each existing destination file
-b
― like--backup
but does not accept an argument
-S
,--suffix=SUFFIX
― override the usual backup suffix
The backup suffix is
~
, unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
. The version control method may be selected via the--backup
option or through theVERSION_CONTROL
environment variable. Here are the values:
none
,off
: never make backups (even if--backup
is given)
numbered
,t
: make numbered backups
existing
,nil
: numbered if numbered backups exist, simple otherwise
simple
,never
: always make simple backups
Example
cp --backup=existing --suffix=.orig -t ~/Videos ~/Music/*
This will copy all files in ~/Music
to ~/Videos
. If a file of the same name exists at the destination, it is renamed by appending .orig
to its name as a backup. If a file with the same name as the backup exists, the backup is instead renamed by appending .1
and if that exists as well .2
and so forth. Only then is the source file copied to the destination.
If you want to copy files in subdirectories recursively use:
cp -R --backup=existing --suffix=.orig -t ~/Videos ~/Music
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
add a comment |
Found this on superuser:
#!/bin/bash
cp -vn "$1" "$2"/ || cp -vn "$1" "$2"/"${1##*/}"~"$(md5sum "$1" | cut -f1 -d' ')"
The file that has the same name gets renamed to the file with the md5sum added to the name. If you save it to a filename like "saveCopy" you can use find
like this to execute it:
find . -name 'z*.jpg' -exec ./saveCopy {} /tmp/Extracted/ ;
For more on this see the link.
add a comment |
There was a solution (ultracopier) to this question in this forum before: see https://ubuntuforums.org/showthread.php?t=2251859 According to that discussion, it can eb integrated into Nautilus.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f538913%2fhow-can-i-copy-files-with-duplicate-filenames-into-one-directory-and-retain-both%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Unfortunately Nautilus doesn't have that option. You could try another file manager like Dolphin or you can use the command line program cp(1)
with the backup option:
cp --backup -t DESTINATION SOURCE [SOURCE...]
This has the following effects which can be controlled with other options as described in the manual page of cp(1)
:
--backup[=CONTROL]
― make a backup of each existing destination file
-b
― like--backup
but does not accept an argument
-S
,--suffix=SUFFIX
― override the usual backup suffix
The backup suffix is
~
, unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
. The version control method may be selected via the--backup
option or through theVERSION_CONTROL
environment variable. Here are the values:
none
,off
: never make backups (even if--backup
is given)
numbered
,t
: make numbered backups
existing
,nil
: numbered if numbered backups exist, simple otherwise
simple
,never
: always make simple backups
Example
cp --backup=existing --suffix=.orig -t ~/Videos ~/Music/*
This will copy all files in ~/Music
to ~/Videos
. If a file of the same name exists at the destination, it is renamed by appending .orig
to its name as a backup. If a file with the same name as the backup exists, the backup is instead renamed by appending .1
and if that exists as well .2
and so forth. Only then is the source file copied to the destination.
If you want to copy files in subdirectories recursively use:
cp -R --backup=existing --suffix=.orig -t ~/Videos ~/Music
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
add a comment |
Unfortunately Nautilus doesn't have that option. You could try another file manager like Dolphin or you can use the command line program cp(1)
with the backup option:
cp --backup -t DESTINATION SOURCE [SOURCE...]
This has the following effects which can be controlled with other options as described in the manual page of cp(1)
:
--backup[=CONTROL]
― make a backup of each existing destination file
-b
― like--backup
but does not accept an argument
-S
,--suffix=SUFFIX
― override the usual backup suffix
The backup suffix is
~
, unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
. The version control method may be selected via the--backup
option or through theVERSION_CONTROL
environment variable. Here are the values:
none
,off
: never make backups (even if--backup
is given)
numbered
,t
: make numbered backups
existing
,nil
: numbered if numbered backups exist, simple otherwise
simple
,never
: always make simple backups
Example
cp --backup=existing --suffix=.orig -t ~/Videos ~/Music/*
This will copy all files in ~/Music
to ~/Videos
. If a file of the same name exists at the destination, it is renamed by appending .orig
to its name as a backup. If a file with the same name as the backup exists, the backup is instead renamed by appending .1
and if that exists as well .2
and so forth. Only then is the source file copied to the destination.
If you want to copy files in subdirectories recursively use:
cp -R --backup=existing --suffix=.orig -t ~/Videos ~/Music
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
add a comment |
Unfortunately Nautilus doesn't have that option. You could try another file manager like Dolphin or you can use the command line program cp(1)
with the backup option:
cp --backup -t DESTINATION SOURCE [SOURCE...]
This has the following effects which can be controlled with other options as described in the manual page of cp(1)
:
--backup[=CONTROL]
― make a backup of each existing destination file
-b
― like--backup
but does not accept an argument
-S
,--suffix=SUFFIX
― override the usual backup suffix
The backup suffix is
~
, unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
. The version control method may be selected via the--backup
option or through theVERSION_CONTROL
environment variable. Here are the values:
none
,off
: never make backups (even if--backup
is given)
numbered
,t
: make numbered backups
existing
,nil
: numbered if numbered backups exist, simple otherwise
simple
,never
: always make simple backups
Example
cp --backup=existing --suffix=.orig -t ~/Videos ~/Music/*
This will copy all files in ~/Music
to ~/Videos
. If a file of the same name exists at the destination, it is renamed by appending .orig
to its name as a backup. If a file with the same name as the backup exists, the backup is instead renamed by appending .1
and if that exists as well .2
and so forth. Only then is the source file copied to the destination.
If you want to copy files in subdirectories recursively use:
cp -R --backup=existing --suffix=.orig -t ~/Videos ~/Music
Unfortunately Nautilus doesn't have that option. You could try another file manager like Dolphin or you can use the command line program cp(1)
with the backup option:
cp --backup -t DESTINATION SOURCE [SOURCE...]
This has the following effects which can be controlled with other options as described in the manual page of cp(1)
:
--backup[=CONTROL]
― make a backup of each existing destination file
-b
― like--backup
but does not accept an argument
-S
,--suffix=SUFFIX
― override the usual backup suffix
The backup suffix is
~
, unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
. The version control method may be selected via the--backup
option or through theVERSION_CONTROL
environment variable. Here are the values:
none
,off
: never make backups (even if--backup
is given)
numbered
,t
: make numbered backups
existing
,nil
: numbered if numbered backups exist, simple otherwise
simple
,never
: always make simple backups
Example
cp --backup=existing --suffix=.orig -t ~/Videos ~/Music/*
This will copy all files in ~/Music
to ~/Videos
. If a file of the same name exists at the destination, it is renamed by appending .orig
to its name as a backup. If a file with the same name as the backup exists, the backup is instead renamed by appending .1
and if that exists as well .2
and so forth. Only then is the source file copied to the destination.
If you want to copy files in subdirectories recursively use:
cp -R --backup=existing --suffix=.orig -t ~/Videos ~/Music
edited Dec 8 at 17:04
answered Oct 19 '14 at 10:51
David Foerster
27.7k1364109
27.7k1364109
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
add a comment |
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
Thanks for the suggestion to use a different file manager. Unfortunately, Thunar also doesn't have the option that I'm referring to. It just has: Cancel, Skip All, Skip, Replace, Replace All. Will try out Dolphin.
– heisenbergman
Oct 19 '14 at 11:12
1
1
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Dolphin works great for this :)
– heisenbergman
Oct 19 '14 at 13:05
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
Thanks for trying out the two. I'll update my question according to your findings.
– David Foerster
Oct 19 '14 at 13:11
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
@heisenbergman, Hi what did you mean by Dolphin works great for this? It does offer the option to rename, but it still only allows me to rename the files one by one. Unfortunately the "apply to all" option cannot be used with the option to rename. This is quite useless for a large amount of files. Is this just my version? Did you manage to rename all your doubles at once (like you can in Windows), using Dolphin?
– Kvothe
Feb 27 at 13:46
add a comment |
Found this on superuser:
#!/bin/bash
cp -vn "$1" "$2"/ || cp -vn "$1" "$2"/"${1##*/}"~"$(md5sum "$1" | cut -f1 -d' ')"
The file that has the same name gets renamed to the file with the md5sum added to the name. If you save it to a filename like "saveCopy" you can use find
like this to execute it:
find . -name 'z*.jpg' -exec ./saveCopy {} /tmp/Extracted/ ;
For more on this see the link.
add a comment |
Found this on superuser:
#!/bin/bash
cp -vn "$1" "$2"/ || cp -vn "$1" "$2"/"${1##*/}"~"$(md5sum "$1" | cut -f1 -d' ')"
The file that has the same name gets renamed to the file with the md5sum added to the name. If you save it to a filename like "saveCopy" you can use find
like this to execute it:
find . -name 'z*.jpg' -exec ./saveCopy {} /tmp/Extracted/ ;
For more on this see the link.
add a comment |
Found this on superuser:
#!/bin/bash
cp -vn "$1" "$2"/ || cp -vn "$1" "$2"/"${1##*/}"~"$(md5sum "$1" | cut -f1 -d' ')"
The file that has the same name gets renamed to the file with the md5sum added to the name. If you save it to a filename like "saveCopy" you can use find
like this to execute it:
find . -name 'z*.jpg' -exec ./saveCopy {} /tmp/Extracted/ ;
For more on this see the link.
Found this on superuser:
#!/bin/bash
cp -vn "$1" "$2"/ || cp -vn "$1" "$2"/"${1##*/}"~"$(md5sum "$1" | cut -f1 -d' ')"
The file that has the same name gets renamed to the file with the md5sum added to the name. If you save it to a filename like "saveCopy" you can use find
like this to execute it:
find . -name 'z*.jpg' -exec ./saveCopy {} /tmp/Extracted/ ;
For more on this see the link.
edited Mar 20 '17 at 10:04
Community♦
1
1
answered Oct 19 '14 at 10:52
Rinzwind
203k27388522
203k27388522
add a comment |
add a comment |
There was a solution (ultracopier) to this question in this forum before: see https://ubuntuforums.org/showthread.php?t=2251859 According to that discussion, it can eb integrated into Nautilus.
add a comment |
There was a solution (ultracopier) to this question in this forum before: see https://ubuntuforums.org/showthread.php?t=2251859 According to that discussion, it can eb integrated into Nautilus.
add a comment |
There was a solution (ultracopier) to this question in this forum before: see https://ubuntuforums.org/showthread.php?t=2251859 According to that discussion, it can eb integrated into Nautilus.
There was a solution (ultracopier) to this question in this forum before: see https://ubuntuforums.org/showthread.php?t=2251859 According to that discussion, it can eb integrated into Nautilus.
answered Dec 8 at 19:11
Adalbert Hanßen
1215
1215
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f538913%2fhow-can-i-copy-files-with-duplicate-filenames-into-one-directory-and-retain-both%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown