Move multiple files with same name in same directory Announcing the arrival of Valued...
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
Is there a kind of relay only consumes power when switching?
How to answer "Have you ever been terminated?"
Significance of Cersei's obsession with elephants?
Is CEO the profession with the most psychopaths?
Around usage results
An adverb for when you're not exaggerating
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Is the Standard Deduction better than Itemized when both are the same amount?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Do wooden building fires get hotter than 600°C?
When was Kai Tak permanently closed to cargo service?
How to Make a Beautiful Stacked 3D Plot
Crossing US/Canada Border for less than 24 hours
Why wasn't DOSKEY integrated with COMMAND.COM?
Is it cost-effective to upgrade an old-ish Giant Escape R3 commuter bike with entry-level branded parts (wheels, drivetrain)?
Is it a good idea to use CNN to classify 1D signal?
Can you use the Shield Master feat to shove someone before you make an attack by using a Readied action?
How to convince students of the implication truth values?
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
What is the longest distance a player character can jump in one leap?
Why didn't Eitri join the fight?
Can anything be seen from the center of the Boötes void? How dark would it be?
How do pianists reach extremely loud dynamics?
Move multiple files with same name in same directory
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow to move all files with a certain file extension from subdirectories to a single directoryFastest way to read last line within pattern of multiple files with the same extensionRename first part of multiple files with mvcannot move Directory not emptyRecursive move (`mv -rn`, like `cp -rn`), a move that will only move not present filesHow to move files with name containing multiple special char like 'é' 'ä' 'space'?How can I copy/move the same x files from one directory to another?Running multiple instances of perl via xargsMove files that have the same case-insensitive filenamemove files of certain type and rename ones with the same name
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a directory with multiple files of same name.
../directory ls
File.txt
File.txt
File1.txt
How can I move all files to a new directory (/new) using mv
../new ls
File.txt
File.txt
File1.txt
Update:
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
And by "processed" all I am doing is Copying it to one Dir. And Archive in another using MV. Using cp n mv only one instance of the file is being processed.
command-line files mv
add a comment |
I have a directory with multiple files of same name.
../directory ls
File.txt
File.txt
File1.txt
How can I move all files to a new directory (/new) using mv
../new ls
File.txt
File.txt
File1.txt
Update:
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
And by "processed" all I am doing is Copying it to one Dir. And Archive in another using MV. Using cp n mv only one instance of the file is being processed.
command-line files mv
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
1
Because you have a fixed filename, the FTP process will overwrite the previousinput.txt
, so you will only have a single file calledinput.txt
at a time (which will be the most recent one).
– icarus
Nov 28 '16 at 3:02
add a comment |
I have a directory with multiple files of same name.
../directory ls
File.txt
File.txt
File1.txt
How can I move all files to a new directory (/new) using mv
../new ls
File.txt
File.txt
File1.txt
Update:
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
And by "processed" all I am doing is Copying it to one Dir. And Archive in another using MV. Using cp n mv only one instance of the file is being processed.
command-line files mv
I have a directory with multiple files of same name.
../directory ls
File.txt
File.txt
File1.txt
How can I move all files to a new directory (/new) using mv
../new ls
File.txt
File.txt
File1.txt
Update:
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
And by "processed" all I am doing is Copying it to one Dir. And Archive in another using MV. Using cp n mv only one instance of the file is being processed.
command-line files mv
command-line files mv
edited Dec 1 '18 at 8:56
Prvt_Yadv
3,30631530
3,30631530
asked Nov 28 '16 at 2:20
DudDud
134
134
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
1
Because you have a fixed filename, the FTP process will overwrite the previousinput.txt
, so you will only have a single file calledinput.txt
at a time (which will be the most recent one).
– icarus
Nov 28 '16 at 3:02
add a comment |
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
1
Because you have a fixed filename, the FTP process will overwrite the previousinput.txt
, so you will only have a single file calledinput.txt
at a time (which will be the most recent one).
– icarus
Nov 28 '16 at 3:02
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
1
1
Because you have a fixed filename, the FTP process will overwrite the previous
input.txt
, so you will only have a single file called input.txt
at a time (which will be the most recent one).– icarus
Nov 28 '16 at 3:02
Because you have a fixed filename, the FTP process will overwrite the previous
input.txt
, so you will only have a single file called input.txt
at a time (which will be the most recent one).– icarus
Nov 28 '16 at 3:02
add a comment |
2 Answers
2
active
oldest
votes
I have a directory with multiple files of same name.
Well, you shouldn't. How can you even cat
their contents? (that is, without getting only the first file of the same name each time).
How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt
I'd settle for trying to give them different names:
mv File.txt ../new/File.txt.1
mv File.txt ../new/File.txt.2
and see if you end up with distinct files that way.
Update: The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script.
This is overwhelmingly unlikely to result in a situation in which you have multiple files with the same name in the same directory. So don't sweat that case, I guess.
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
add a comment |
Can you not use a wildcard to move it all e.g.
mv file.tx* /new/
This will move all files that have a name that starts with file.tx
to your directory /new
. It will leave behind any files that don't match, so file1.txt
will stay in the directory. If you want to move any file with name file.txt and file1.txt you could move your wildcard * to after file e.g. file*
this will then move any file in that directory that has a name starting with file.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f326465%2fmove-multiple-files-with-same-name-in-same-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have a directory with multiple files of same name.
Well, you shouldn't. How can you even cat
their contents? (that is, without getting only the first file of the same name each time).
How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt
I'd settle for trying to give them different names:
mv File.txt ../new/File.txt.1
mv File.txt ../new/File.txt.2
and see if you end up with distinct files that way.
Update: The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script.
This is overwhelmingly unlikely to result in a situation in which you have multiple files with the same name in the same directory. So don't sweat that case, I guess.
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
add a comment |
I have a directory with multiple files of same name.
Well, you shouldn't. How can you even cat
their contents? (that is, without getting only the first file of the same name each time).
How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt
I'd settle for trying to give them different names:
mv File.txt ../new/File.txt.1
mv File.txt ../new/File.txt.2
and see if you end up with distinct files that way.
Update: The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script.
This is overwhelmingly unlikely to result in a situation in which you have multiple files with the same name in the same directory. So don't sweat that case, I guess.
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
add a comment |
I have a directory with multiple files of same name.
Well, you shouldn't. How can you even cat
their contents? (that is, without getting only the first file of the same name each time).
How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt
I'd settle for trying to give them different names:
mv File.txt ../new/File.txt.1
mv File.txt ../new/File.txt.2
and see if you end up with distinct files that way.
Update: The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script.
This is overwhelmingly unlikely to result in a situation in which you have multiple files with the same name in the same directory. So don't sweat that case, I guess.
I have a directory with multiple files of same name.
Well, you shouldn't. How can you even cat
their contents? (that is, without getting only the first file of the same name each time).
How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt
I'd settle for trying to give them different names:
mv File.txt ../new/File.txt.1
mv File.txt ../new/File.txt.2
and see if you end up with distinct files that way.
Update: The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script.
This is overwhelmingly unlikely to result in a situation in which you have multiple files with the same name in the same directory. So don't sweat that case, I guess.
edited Nov 28 '16 at 2:47
answered Nov 28 '16 at 2:36
DepressedDanielDepressedDaniel
3,500614
3,500614
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
add a comment |
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
The files are being FTPed to an UNIX directory by a source system, which needs to be processed using shell script. Once done I need to move multiple instances of the same file (if any) to an Archive directory.
– Dud
Nov 28 '16 at 2:40
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
@Dudul Please update your question with more details of this process.
– DepressedDaniel
Nov 28 '16 at 2:41
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
Thanks Daniel. I hope this makes it clearer. Should had put in the description.
– Dud
Nov 28 '16 at 2:42
add a comment |
Can you not use a wildcard to move it all e.g.
mv file.tx* /new/
This will move all files that have a name that starts with file.tx
to your directory /new
. It will leave behind any files that don't match, so file1.txt
will stay in the directory. If you want to move any file with name file.txt and file1.txt you could move your wildcard * to after file e.g. file*
this will then move any file in that directory that has a name starting with file.
add a comment |
Can you not use a wildcard to move it all e.g.
mv file.tx* /new/
This will move all files that have a name that starts with file.tx
to your directory /new
. It will leave behind any files that don't match, so file1.txt
will stay in the directory. If you want to move any file with name file.txt and file1.txt you could move your wildcard * to after file e.g. file*
this will then move any file in that directory that has a name starting with file.
add a comment |
Can you not use a wildcard to move it all e.g.
mv file.tx* /new/
This will move all files that have a name that starts with file.tx
to your directory /new
. It will leave behind any files that don't match, so file1.txt
will stay in the directory. If you want to move any file with name file.txt and file1.txt you could move your wildcard * to after file e.g. file*
this will then move any file in that directory that has a name starting with file.
Can you not use a wildcard to move it all e.g.
mv file.tx* /new/
This will move all files that have a name that starts with file.tx
to your directory /new
. It will leave behind any files that don't match, so file1.txt
will stay in the directory. If you want to move any file with name file.txt and file1.txt you could move your wildcard * to after file e.g. file*
this will then move any file in that directory that has a name starting with file.
edited 7 hours ago
Rui F Ribeiro
42.1k1484142
42.1k1484142
answered Nov 28 '16 at 15:25
a.smitha.smith
1531314
1531314
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f326465%2fmove-multiple-files-with-same-name-in-same-directory%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
Thanks @icarus. Have updated the description with a detailed scenario.
– Dud
Nov 28 '16 at 2:44
Ah, so does this mean that you have a fixed name, e.g. results, which is being pushed in via FTP, and you need to move this to a variable filename like Archive/results.2016.11.27.1315 ?
– icarus
Nov 28 '16 at 2:47
Yes. I need to handle multiple instances of the file (which does has a fixed name). Say suppose I have input.txt with 10 EMP details and I unable to process the data. When the next set of file comes with the same name, I am able to move only one file for processing. The most recent one.
– Dud
Nov 28 '16 at 2:52
1
Because you have a fixed filename, the FTP process will overwrite the previous
input.txt
, so you will only have a single file calledinput.txt
at a time (which will be the most recent one).– icarus
Nov 28 '16 at 3:02