Looping through all files, skipping some dynamically Announcing the arrival of Valued...
What is the electric potential inside a point charge?
How to retrograde a note sequence in Finale?
Autumning in love
Do working physicists consider Newtonian mechanics to be "falsified"?
Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?
Working around an AWS network ACL rule limit
Using "nakedly" instead of "with nothing on"
Classification of bundles, Postnikov towers, obstruction theory, local coefficients
Should you tell Jews they are breaking a commandment?
How do I automatically answer y in bash script?
Strange behaviour of Check
How are presidential pardons supposed to be used?
Estimated State payment too big --> money back; + 2018 Tax Reform
Passing functions in C++
Windows 10: How to Lock (not sleep) laptop on lid close?
I'm thinking of a number
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Estimate capacitor parameters
What would be Julian Assange's expected punishment, on the current English criminal law?
3 doors, three guards, one stone
Determine whether f is a function, an injection, a surjection
What do you call a plan that's an alternative plan in case your initial plan fails?
Slither Like a Snake
Is it possible to ask for a hotel room without minibar/extra services?
Looping through all files, skipping some dynamically
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” questionWhy is looping over find's output bad practice?Exclude directory in findBash script for looping through filesLooping through a file using a columnLooping through unix datesLooping through lines in several files (bash)Bash looping through two sets of fileslooping through JSON array in shell scriptLooping through an array with for gives different resultsNeed to iterate through subdirectories, concatenating files, with an iterative numberFlatpak - Safely Relocate Sandboxed Home DirectoryWhile loops not looping through all values
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
rather new to unix. Trying to create a script to loop through all files and subdirectories given a directory and printing them. I would like to be able to skip certain directories dynamically though.
My idea was to create a for loop, for i in $(find ./ -printf '%fn')
as this will iterate through everything from the given directory, but I was curious if there was a way to skip over a directory if I came across one I didn't want to go down.
As in if [ "$i" == something I don't want to go down]
then
skip this directory
fi
Wasn't sure if it was possible. Found ways to skip directories using prune function but this requires you to know the types you want to skip beforehand, at least that was my understanding. Thanks.
linux bash shell scripting
New contributor
add a comment |
rather new to unix. Trying to create a script to loop through all files and subdirectories given a directory and printing them. I would like to be able to skip certain directories dynamically though.
My idea was to create a for loop, for i in $(find ./ -printf '%fn')
as this will iterate through everything from the given directory, but I was curious if there was a way to skip over a directory if I came across one I didn't want to go down.
As in if [ "$i" == something I don't want to go down]
then
skip this directory
fi
Wasn't sure if it was possible. Found ways to skip directories using prune function but this requires you to know the types you want to skip beforehand, at least that was my understanding. Thanks.
linux bash shell scripting
New contributor
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago
add a comment |
rather new to unix. Trying to create a script to loop through all files and subdirectories given a directory and printing them. I would like to be able to skip certain directories dynamically though.
My idea was to create a for loop, for i in $(find ./ -printf '%fn')
as this will iterate through everything from the given directory, but I was curious if there was a way to skip over a directory if I came across one I didn't want to go down.
As in if [ "$i" == something I don't want to go down]
then
skip this directory
fi
Wasn't sure if it was possible. Found ways to skip directories using prune function but this requires you to know the types you want to skip beforehand, at least that was my understanding. Thanks.
linux bash shell scripting
New contributor
rather new to unix. Trying to create a script to loop through all files and subdirectories given a directory and printing them. I would like to be able to skip certain directories dynamically though.
My idea was to create a for loop, for i in $(find ./ -printf '%fn')
as this will iterate through everything from the given directory, but I was curious if there was a way to skip over a directory if I came across one I didn't want to go down.
As in if [ "$i" == something I don't want to go down]
then
skip this directory
fi
Wasn't sure if it was possible. Found ways to skip directories using prune function but this requires you to know the types you want to skip beforehand, at least that was my understanding. Thanks.
linux bash shell scripting
linux bash shell scripting
New contributor
New contributor
New contributor
asked 6 mins ago
m.smith7878m.smith7878
1
1
New contributor
New contributor
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago
add a comment |
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago
add a comment |
0
active
oldest
votes
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
});
}
});
m.smith7878 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f512466%2flooping-through-all-files-skipping-some-dynamically%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
m.smith7878 is a new contributor. Be nice, and check out our Code of Conduct.
m.smith7878 is a new contributor. Be nice, and check out our Code of Conduct.
m.smith7878 is a new contributor. Be nice, and check out our Code of Conduct.
m.smith7878 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f512466%2flooping-through-all-files-skipping-some-dynamically%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
See Exclude directory in find - and also Why is looping over find's output bad practice?
– steeldriver
1 min ago