How to make a script to move files with find and regex
Im trying to make a find regex script so i automaticly can copy files to specific directory.
find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;
Made this script, dont get any errors but it doesnt list anything.
Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
Is there something wrong i have done or is this something that's not easy to get to work?
find regular-expression
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Im trying to make a find regex script so i automaticly can copy files to specific directory.
find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;
Made this script, dont get any errors but it doesnt list anything.
Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
Is there something wrong i have done or is this something that's not easy to get to work?
find regular-expression
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Im trying to make a find regex script so i automaticly can copy files to specific directory.
find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;
Made this script, dont get any errors but it doesnt list anything.
Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
Is there something wrong i have done or is this something that's not easy to get to work?
find regular-expression
Im trying to make a find regex script so i automaticly can copy files to specific directory.
find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;
Made this script, dont get any errors but it doesnt list anything.
Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
Is there something wrong i have done or is this something that's not easy to get to work?
find regular-expression
find regular-expression
edited Jan 20 '15 at 22:57
Gilles
535k12810811598
535k12810811598
asked Jan 20 '15 at 13:00
stonestone
12
12
bumped to the homepage by Community♦ 2 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♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
GNU findutils uses Emacs style regex, so out of box, this should suffice:
find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
add a comment |
Found the solution
find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;
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%2f180049%2fhow-to-make-a-script-to-move-files-with-find-and-regex%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
GNU findutils uses Emacs style regex, so out of box, this should suffice:
find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
add a comment |
GNU findutils uses Emacs style regex, so out of box, this should suffice:
find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
add a comment |
GNU findutils uses Emacs style regex, so out of box, this should suffice:
find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;
GNU findutils uses Emacs style regex, so out of box, this should suffice:
find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;
answered Jan 20 '15 at 13:18
PriitPriit
291
291
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
add a comment |
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"
– stone
Jan 20 '15 at 13:39
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?
– Priit
Jan 20 '15 at 13:41
add a comment |
Found the solution
find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;
add a comment |
Found the solution
find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;
add a comment |
Found the solution
find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;
Found the solution
find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;
answered Jan 20 '15 at 13:45
stonestone
12
12
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%2f180049%2fhow-to-make-a-script-to-move-files-with-find-and-regex%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