How do I copy all the files containing “t_1” in the name to a different directory using one command?How...
What reason would an alien civilization have for building a Dyson Sphere (or Swarm) if cheap Nuclear fusion is available?
Employer wants to use my work email account after I quit, is this legal under German law? Is this a GDPR waiver?
Alphabet completion rate
Why is Madam Hooch not a professor?
Is there a maximum distance from a planet that a moon can orbit?
Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?
ては's role in this 「追いかけては来ないでしょう」
First-year PhD giving a talk among well-established researchers in the field
What are the benefits of using the X Card safety tool in comparison to plain communication?
What kind of wire should I use to pigtail an outlet?
Fedora boot screen shows both Fedora logo and Lenovo logo. Why and How?
Using “sparkling” as a diminutive of “spark” in a poem
How come I was asked by a CBP officer why I was in the US?
Do French speakers not use the subjunctive informally?
How to reply to small talk/random facts in a non-offensive way?
No IMPLICIT_CONVERSION warning in this query plan
How can I convince my reader that I will not use a certain trope?
How to append a matrix element by element
A player is constantly pestering me about rules, what do I do as a DM?
Why aren't (poly-)cotton tents more popular?
Story-based adventure with functions and relationships
Why doesn't a marching band have strings?
Is my Rep in Stack-Exchange Form?
Should I include salary information on my CV?
How do I copy all the files containing “t_1” in the name to a different directory using one command?
How can I selectively copy files from one directory to another directory?Copy only regular files from one directory to anotherHow use minimum number of commands to copy all .txt files from all subdirectories to one directory?find file, copy but with different nameUsing cp to replace a directory of the same nameCopy files with different names from different directoriesCopy All Files With Certain Length File NameCopying multiple types of files in one commandCopy files under modified nameHow could I copy the same directory multiple times but with a different name?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
How do I copy all the files with "t_1" in the name to a different directory using one command?
files wildcards cp
bumped to the homepage by Community♦ 27 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
|
show 1 more comment
How do I copy all the files with "t_1" in the name to a different directory using one command?
files wildcards cp
bumped to the homepage by Community♦ 27 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
cp "*t_1*" /target/dir/
...
– jasonwryan
Sep 24 '16 at 0:58
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
Are you in a directory that includes at least one file witht_1
in the name?
– jasonwryan
Sep 24 '16 at 1:15
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
2
Remove the quotes:*t_1*
...
– jasonwryan
Sep 24 '16 at 1:26
|
show 1 more comment
How do I copy all the files with "t_1" in the name to a different directory using one command?
files wildcards cp
How do I copy all the files with "t_1" in the name to a different directory using one command?
files wildcards cp
files wildcards cp
edited Dec 20 '18 at 7:16
Rui F Ribeiro
40.5k16 gold badges89 silver badges150 bronze badges
40.5k16 gold badges89 silver badges150 bronze badges
asked Sep 24 '16 at 0:46
JarheadJarhead
61 bronze badge
61 bronze badge
bumped to the homepage by Community♦ 27 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 27 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
cp "*t_1*" /target/dir/
...
– jasonwryan
Sep 24 '16 at 0:58
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
Are you in a directory that includes at least one file witht_1
in the name?
– jasonwryan
Sep 24 '16 at 1:15
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
2
Remove the quotes:*t_1*
...
– jasonwryan
Sep 24 '16 at 1:26
|
show 1 more comment
2
cp "*t_1*" /target/dir/
...
– jasonwryan
Sep 24 '16 at 0:58
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
Are you in a directory that includes at least one file witht_1
in the name?
– jasonwryan
Sep 24 '16 at 1:15
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
2
Remove the quotes:*t_1*
...
– jasonwryan
Sep 24 '16 at 1:26
2
2
cp "*t_1*" /target/dir/
...– jasonwryan
Sep 24 '16 at 0:58
cp "*t_1*" /target/dir/
...– jasonwryan
Sep 24 '16 at 0:58
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
Are you in a directory that includes at least one file with
t_1
in the name?– jasonwryan
Sep 24 '16 at 1:15
Are you in a directory that includes at least one file with
t_1
in the name?– jasonwryan
Sep 24 '16 at 1:15
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
2
2
Remove the quotes:
*t_1*
...– jasonwryan
Sep 24 '16 at 1:26
Remove the quotes:
*t_1*
...– jasonwryan
Sep 24 '16 at 1:26
|
show 1 more comment
2 Answers
2
active
oldest
votes
Here is a quick fix..
find ./ -name '*t_1*' -exec mv '{}' ./ ;
This code will move all the files (containing the search pattern in the file name) one level up the hierarchy.
For example, Let's say that all your 't_1' files are stored in /Home/Desktop/ directory. Then just go to /Home/ from terminal and execute this command. All the 't_1' files will be moved from /home/Desktop/ to /home/ directory.
All the files irrespective of the position of t_1 in the filename will be copied.
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
add a comment |
Try cp /path/to/files/*t_1* /path/to/destination
That should work.
Or:
for f in ./*t_1*; do
cp "$f" /path/to/destination
done
That should work for sure.
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%2f311984%2fhow-do-i-copy-all-the-files-containing-t-1-in-the-name-to-a-different-director%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
Here is a quick fix..
find ./ -name '*t_1*' -exec mv '{}' ./ ;
This code will move all the files (containing the search pattern in the file name) one level up the hierarchy.
For example, Let's say that all your 't_1' files are stored in /Home/Desktop/ directory. Then just go to /Home/ from terminal and execute this command. All the 't_1' files will be moved from /home/Desktop/ to /home/ directory.
All the files irrespective of the position of t_1 in the filename will be copied.
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
add a comment |
Here is a quick fix..
find ./ -name '*t_1*' -exec mv '{}' ./ ;
This code will move all the files (containing the search pattern in the file name) one level up the hierarchy.
For example, Let's say that all your 't_1' files are stored in /Home/Desktop/ directory. Then just go to /Home/ from terminal and execute this command. All the 't_1' files will be moved from /home/Desktop/ to /home/ directory.
All the files irrespective of the position of t_1 in the filename will be copied.
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
add a comment |
Here is a quick fix..
find ./ -name '*t_1*' -exec mv '{}' ./ ;
This code will move all the files (containing the search pattern in the file name) one level up the hierarchy.
For example, Let's say that all your 't_1' files are stored in /Home/Desktop/ directory. Then just go to /Home/ from terminal and execute this command. All the 't_1' files will be moved from /home/Desktop/ to /home/ directory.
All the files irrespective of the position of t_1 in the filename will be copied.
Here is a quick fix..
find ./ -name '*t_1*' -exec mv '{}' ./ ;
This code will move all the files (containing the search pattern in the file name) one level up the hierarchy.
For example, Let's say that all your 't_1' files are stored in /Home/Desktop/ directory. Then just go to /Home/ from terminal and execute this command. All the 't_1' files will be moved from /home/Desktop/ to /home/ directory.
All the files irrespective of the position of t_1 in the filename will be copied.
answered Sep 24 '16 at 6:01
Upendra Pratap SinghUpendra Pratap Singh
2411 gold badge2 silver badges11 bronze badges
2411 gold badge2 silver badges11 bronze badges
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
add a comment |
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
just copy the command as it is....presence or absence of a whitespace will affect the results. I have tried and tested this command before posting this answer
– Upendra Pratap Singh
Sep 24 '16 at 6:03
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
once you have all your files in the parent folder, you can move the entire parent folder wherever you wish
– Upendra Pratap Singh
Sep 24 '16 at 6:09
add a comment |
Try cp /path/to/files/*t_1* /path/to/destination
That should work.
Or:
for f in ./*t_1*; do
cp "$f" /path/to/destination
done
That should work for sure.
add a comment |
Try cp /path/to/files/*t_1* /path/to/destination
That should work.
Or:
for f in ./*t_1*; do
cp "$f" /path/to/destination
done
That should work for sure.
add a comment |
Try cp /path/to/files/*t_1* /path/to/destination
That should work.
Or:
for f in ./*t_1*; do
cp "$f" /path/to/destination
done
That should work for sure.
Try cp /path/to/files/*t_1* /path/to/destination
That should work.
Or:
for f in ./*t_1*; do
cp "$f" /path/to/destination
done
That should work for sure.
edited Sep 24 '16 at 4:45
answered Sep 24 '16 at 4:36
NapoleonTheCakeNapoleonTheCake
741 silver badge8 bronze badges
741 silver badge8 bronze badges
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%2f311984%2fhow-do-i-copy-all-the-files-containing-t-1-in-the-name-to-a-different-director%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
2
cp "*t_1*" /target/dir/
...– jasonwryan
Sep 24 '16 at 0:58
@jasonwryan it is saying "cp: cannot stat ‘t_1’: No such file or directory"
– Jarhead
Sep 24 '16 at 1:05
Are you in a directory that includes at least one file with
t_1
in the name?– jasonwryan
Sep 24 '16 at 1:15
Yes because I can do ls | grep "t_1" and files show up. There are 4.
– Jarhead
Sep 24 '16 at 1:22
2
Remove the quotes:
*t_1*
...– jasonwryan
Sep 24 '16 at 1:26