Script for moving all *.512.png to a new folder
Can you make a script(bash) for moving all the files with the ending *.512.png to a new folder like res512(will be new branch) (keeping all the subfolders)
for this repo I tried really long but I can't figure it out.
bash unix sh branch mv
add a comment |
Can you make a script(bash) for moving all the files with the ending *.512.png to a new folder like res512(will be new branch) (keeping all the subfolders)
for this repo I tried really long but I can't figure it out.
bash unix sh branch mv
Keep in mind,mv
doesn't create a new directory, so I assume something likemkdir
would be one of the commands in your scripts. Am I getting this right?
– Samuel
Nov 15 '18 at 19:21
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22
add a comment |
Can you make a script(bash) for moving all the files with the ending *.512.png to a new folder like res512(will be new branch) (keeping all the subfolders)
for this repo I tried really long but I can't figure it out.
bash unix sh branch mv
Can you make a script(bash) for moving all the files with the ending *.512.png to a new folder like res512(will be new branch) (keeping all the subfolders)
for this repo I tried really long but I can't figure it out.
bash unix sh branch mv
bash unix sh branch mv
asked Nov 15 '18 at 19:04
Maximilian GaedigMaximilian Gaedig
31
31
Keep in mind,mv
doesn't create a new directory, so I assume something likemkdir
would be one of the commands in your scripts. Am I getting this right?
– Samuel
Nov 15 '18 at 19:21
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22
add a comment |
Keep in mind,mv
doesn't create a new directory, so I assume something likemkdir
would be one of the commands in your scripts. Am I getting this right?
– Samuel
Nov 15 '18 at 19:21
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22
Keep in mind,
mv
doesn't create a new directory, so I assume something like mkdir
would be one of the commands in your scripts. Am I getting this right?– Samuel
Nov 15 '18 at 19:21
Keep in mind,
mv
doesn't create a new directory, so I assume something like mkdir
would be one of the commands in your scripts. Am I getting this right?– Samuel
Nov 15 '18 at 19:21
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22
add a comment |
1 Answer
1
active
oldest
votes
You're not very specific with what you're asking.
If you want to move all files that have the suffix .512.png
from within your current directory to a new directory, you can use the following
mkdir res512
cp -r *.512.png res512/
If you want to move all files that have the suffix .512.png
from within your directory and all child directories into a new directory, you can use
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
If you want to move all files that have the suffix .512.png
including their directory structure into a new directory, you can use
find . -name '*.512.png' -exec cp --parents res512/ ;
Replace
cp
withmv
if you want to move the files instead of copy them.
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.
– Nathan Fiscaletti
Nov 15 '18 at 20:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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%2fstackoverflow.com%2fquestions%2f53326321%2fscript-for-moving-all-512-png-to-a-new-folder%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're not very specific with what you're asking.
If you want to move all files that have the suffix .512.png
from within your current directory to a new directory, you can use the following
mkdir res512
cp -r *.512.png res512/
If you want to move all files that have the suffix .512.png
from within your directory and all child directories into a new directory, you can use
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
If you want to move all files that have the suffix .512.png
including their directory structure into a new directory, you can use
find . -name '*.512.png' -exec cp --parents res512/ ;
Replace
cp
withmv
if you want to move the files instead of copy them.
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.
– Nathan Fiscaletti
Nov 15 '18 at 20:00
add a comment |
You're not very specific with what you're asking.
If you want to move all files that have the suffix .512.png
from within your current directory to a new directory, you can use the following
mkdir res512
cp -r *.512.png res512/
If you want to move all files that have the suffix .512.png
from within your directory and all child directories into a new directory, you can use
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
If you want to move all files that have the suffix .512.png
including their directory structure into a new directory, you can use
find . -name '*.512.png' -exec cp --parents res512/ ;
Replace
cp
withmv
if you want to move the files instead of copy them.
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.
– Nathan Fiscaletti
Nov 15 '18 at 20:00
add a comment |
You're not very specific with what you're asking.
If you want to move all files that have the suffix .512.png
from within your current directory to a new directory, you can use the following
mkdir res512
cp -r *.512.png res512/
If you want to move all files that have the suffix .512.png
from within your directory and all child directories into a new directory, you can use
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
If you want to move all files that have the suffix .512.png
including their directory structure into a new directory, you can use
find . -name '*.512.png' -exec cp --parents res512/ ;
Replace
cp
withmv
if you want to move the files instead of copy them.
You're not very specific with what you're asking.
If you want to move all files that have the suffix .512.png
from within your current directory to a new directory, you can use the following
mkdir res512
cp -r *.512.png res512/
If you want to move all files that have the suffix .512.png
from within your directory and all child directories into a new directory, you can use
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
If you want to move all files that have the suffix .512.png
including their directory structure into a new directory, you can use
find . -name '*.512.png' -exec cp --parents res512/ ;
Replace
cp
withmv
if you want to move the files instead of copy them.
edited Mar 1 at 18:22
answered Nov 15 '18 at 19:23
Nathan FiscalettiNathan Fiscaletti
8561440
8561440
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.
– Nathan Fiscaletti
Nov 15 '18 at 20:00
add a comment |
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.
– Nathan Fiscaletti
Nov 15 '18 at 20:00
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
thank you very much, works :) but the subdirectories are not shown
– Maximilian Gaedig
Nov 15 '18 at 19:34
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
@MaximilianGaedig if it works, consider accepting the answer :) And as far as the sub directories, you'll need to be a little more lear with what you want.
– Nathan Fiscaletti
Nov 15 '18 at 19:38
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
The filetree with the folders should be imported
– Maximilian Gaedig
Nov 15 '18 at 19:52
You said you wanted to move the files that have
*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.– Nathan Fiscaletti
Nov 15 '18 at 20:00
You said you wanted to move the files that have
*.512.png
as a suffix, i'm not sure how you want the file structure to factor into this.– Nathan Fiscaletti
Nov 15 '18 at 20:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53326321%2fscript-for-moving-all-512-png-to-a-new-folder%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
Keep in mind,
mv
doesn't create a new directory, so I assume something likemkdir
would be one of the commands in your scripts. Am I getting this right?– Samuel
Nov 15 '18 at 19:21
yes forgotten about this
– Maximilian Gaedig
Nov 15 '18 at 19:22