How can I filter out current directory ('.') in bash?
I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the script kept looping into the current directory (.)
Here's what I currently have:
#!/bin/bash
#---
# flacToMp3: Converts FLAC files in my originalFLAC folder into mp3 files
# and places them in an identical folder structure in my Music
# folder.
#---
function enterDIR {
for DIR in "$(find . -maxdepth 1 -type d)"; do #recurse into every directory below top-level directory
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
function createDirectory {
#recreate directory structure in Music folder
curDir="$pwd"
newDir=${curDir/originalFLAC/Music}
mkdir -p $newDir
}
function convertFLAC {
#convert each flac file in current directory into an mp3 file
for FILE in "$(find . -maxdepth 1 -type f)"; do #loop through all regular (non-directory) files in current directory
if [ "${FILE: -5}" == ".flac" ]; then #if FILE has extension .flac
ffmpeg -i "$FILE" -ab 320k -map_metadata 0 "${FILE%.*}.mp3"; #convert to .mp3
mv -u "${FILE%.*}.mp3" $newDir
else #copy all other files to new directory as-is
cp -ur "$FILE" $newDir
fi
done
}
enterDIR
This script is pretty clunky, since I only just started dipping into Bash. The problem (or at least where I think it is) comes from the if [ "$DIR" == "." ]; then
line - looking at my output when running the script, it doesn't seem to filter it.
How do I filter out (ignore) the current directory?
bash files scripting
add a comment |
I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the script kept looping into the current directory (.)
Here's what I currently have:
#!/bin/bash
#---
# flacToMp3: Converts FLAC files in my originalFLAC folder into mp3 files
# and places them in an identical folder structure in my Music
# folder.
#---
function enterDIR {
for DIR in "$(find . -maxdepth 1 -type d)"; do #recurse into every directory below top-level directory
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
function createDirectory {
#recreate directory structure in Music folder
curDir="$pwd"
newDir=${curDir/originalFLAC/Music}
mkdir -p $newDir
}
function convertFLAC {
#convert each flac file in current directory into an mp3 file
for FILE in "$(find . -maxdepth 1 -type f)"; do #loop through all regular (non-directory) files in current directory
if [ "${FILE: -5}" == ".flac" ]; then #if FILE has extension .flac
ffmpeg -i "$FILE" -ab 320k -map_metadata 0 "${FILE%.*}.mp3"; #convert to .mp3
mv -u "${FILE%.*}.mp3" $newDir
else #copy all other files to new directory as-is
cp -ur "$FILE" $newDir
fi
done
}
enterDIR
This script is pretty clunky, since I only just started dipping into Bash. The problem (or at least where I think it is) comes from the if [ "$DIR" == "." ]; then
line - looking at my output when running the script, it doesn't seem to filter it.
How do I filter out (ignore) the current directory?
bash files scripting
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
Can't you use something likefind . -maxdepth 1 -name "*.flac"
?
– pfnuesel
Jan 22 '16 at 15:33
1
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't usefor
to iterate over lines.
– glenn jackman
Jan 22 '16 at 15:34
I thinkfind . -type f -name "*.flac"
would suffice. Let find delve into your directories.
– glenn jackman
Jan 22 '16 at 15:36
add a comment |
I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the script kept looping into the current directory (.)
Here's what I currently have:
#!/bin/bash
#---
# flacToMp3: Converts FLAC files in my originalFLAC folder into mp3 files
# and places them in an identical folder structure in my Music
# folder.
#---
function enterDIR {
for DIR in "$(find . -maxdepth 1 -type d)"; do #recurse into every directory below top-level directory
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
function createDirectory {
#recreate directory structure in Music folder
curDir="$pwd"
newDir=${curDir/originalFLAC/Music}
mkdir -p $newDir
}
function convertFLAC {
#convert each flac file in current directory into an mp3 file
for FILE in "$(find . -maxdepth 1 -type f)"; do #loop through all regular (non-directory) files in current directory
if [ "${FILE: -5}" == ".flac" ]; then #if FILE has extension .flac
ffmpeg -i "$FILE" -ab 320k -map_metadata 0 "${FILE%.*}.mp3"; #convert to .mp3
mv -u "${FILE%.*}.mp3" $newDir
else #copy all other files to new directory as-is
cp -ur "$FILE" $newDir
fi
done
}
enterDIR
This script is pretty clunky, since I only just started dipping into Bash. The problem (or at least where I think it is) comes from the if [ "$DIR" == "." ]; then
line - looking at my output when running the script, it doesn't seem to filter it.
How do I filter out (ignore) the current directory?
bash files scripting
I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the script kept looping into the current directory (.)
Here's what I currently have:
#!/bin/bash
#---
# flacToMp3: Converts FLAC files in my originalFLAC folder into mp3 files
# and places them in an identical folder structure in my Music
# folder.
#---
function enterDIR {
for DIR in "$(find . -maxdepth 1 -type d)"; do #recurse into every directory below top-level directory
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
function createDirectory {
#recreate directory structure in Music folder
curDir="$pwd"
newDir=${curDir/originalFLAC/Music}
mkdir -p $newDir
}
function convertFLAC {
#convert each flac file in current directory into an mp3 file
for FILE in "$(find . -maxdepth 1 -type f)"; do #loop through all regular (non-directory) files in current directory
if [ "${FILE: -5}" == ".flac" ]; then #if FILE has extension .flac
ffmpeg -i "$FILE" -ab 320k -map_metadata 0 "${FILE%.*}.mp3"; #convert to .mp3
mv -u "${FILE%.*}.mp3" $newDir
else #copy all other files to new directory as-is
cp -ur "$FILE" $newDir
fi
done
}
enterDIR
This script is pretty clunky, since I only just started dipping into Bash. The problem (or at least where I think it is) comes from the if [ "$DIR" == "." ]; then
line - looking at my output when running the script, it doesn't seem to filter it.
How do I filter out (ignore) the current directory?
bash files scripting
bash files scripting
asked Jan 22 '16 at 15:25
DaimyoKirby
1055
1055
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
Can't you use something likefind . -maxdepth 1 -name "*.flac"
?
– pfnuesel
Jan 22 '16 at 15:33
1
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't usefor
to iterate over lines.
– glenn jackman
Jan 22 '16 at 15:34
I thinkfind . -type f -name "*.flac"
would suffice. Let find delve into your directories.
– glenn jackman
Jan 22 '16 at 15:36
add a comment |
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
Can't you use something likefind . -maxdepth 1 -name "*.flac"
?
– pfnuesel
Jan 22 '16 at 15:33
1
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't usefor
to iterate over lines.
– glenn jackman
Jan 22 '16 at 15:34
I thinkfind . -type f -name "*.flac"
would suffice. Let find delve into your directories.
– glenn jackman
Jan 22 '16 at 15:36
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
Can't you use something like
find . -maxdepth 1 -name "*.flac"
?– pfnuesel
Jan 22 '16 at 15:33
Can't you use something like
find . -maxdepth 1 -name "*.flac"
?– pfnuesel
Jan 22 '16 at 15:33
1
1
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't use
for
to iterate over lines.– glenn jackman
Jan 22 '16 at 15:34
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't use
for
to iterate over lines.– glenn jackman
Jan 22 '16 at 15:34
I think
find . -type f -name "*.flac"
would suffice. Let find delve into your directories.– glenn jackman
Jan 22 '16 at 15:36
I think
find . -type f -name "*.flac"
would suffice. Let find delve into your directories.– glenn jackman
Jan 22 '16 at 15:36
add a comment |
2 Answers
2
active
oldest
votes
You can filter it in find
by using -mindepth
option. Like this:
function enterDIR {
find . -mindepth 1-maxdepth 1 -type d | while read DIR ;
do
#recurse into every directory below top-level directory
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
But the whole script doesn't look like a good solution.
If I understand your idea correct, you want to walk through the whole directory tree, create there new directory, convert flac to mp3 if any and copy all non-flac files to a new dir. I would do that this way:
find . -mindepth 1 -type -d -exec mkdir -p {}/originalFLAC/Music +
find . -type f -iname "*.flac" -exec ffmpeg -i {} -ab 320k -map_metadata 0 {}.mp3 ;
find . -type f ! -iname "*.flac" | while read file ; do cp -v "$file" "$(dirname "$file")"/originalFLAC/Music/ ; done
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
!
meansnot
. thereforefind . -type f ! -iname "*.flac"
means find all files with name not matching to.flac
(i before name means case insensitive)
– rush
Jan 22 '16 at 16:10
|
show 2 more comments
try replacing this
for DIR in "$(find . -maxdepth 1 -type d)"
with this
for DIR in "$(find . -maxdepth 1 -type d | grep -v ".$")"
.
is interpreted as "any" single character in regex. So it has to be escaped with backslash. Also since all your lines will start with a dot character, you will need to find the line that has the dot and only the dot. Hence the end of line character $
.
at this point, you should not need the if
block below:
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
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%2f257020%2fhow-can-i-filter-out-current-directory-in-bash%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
You can filter it in find
by using -mindepth
option. Like this:
function enterDIR {
find . -mindepth 1-maxdepth 1 -type d | while read DIR ;
do
#recurse into every directory below top-level directory
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
But the whole script doesn't look like a good solution.
If I understand your idea correct, you want to walk through the whole directory tree, create there new directory, convert flac to mp3 if any and copy all non-flac files to a new dir. I would do that this way:
find . -mindepth 1 -type -d -exec mkdir -p {}/originalFLAC/Music +
find . -type f -iname "*.flac" -exec ffmpeg -i {} -ab 320k -map_metadata 0 {}.mp3 ;
find . -type f ! -iname "*.flac" | while read file ; do cp -v "$file" "$(dirname "$file")"/originalFLAC/Music/ ; done
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
!
meansnot
. thereforefind . -type f ! -iname "*.flac"
means find all files with name not matching to.flac
(i before name means case insensitive)
– rush
Jan 22 '16 at 16:10
|
show 2 more comments
You can filter it in find
by using -mindepth
option. Like this:
function enterDIR {
find . -mindepth 1-maxdepth 1 -type d | while read DIR ;
do
#recurse into every directory below top-level directory
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
But the whole script doesn't look like a good solution.
If I understand your idea correct, you want to walk through the whole directory tree, create there new directory, convert flac to mp3 if any and copy all non-flac files to a new dir. I would do that this way:
find . -mindepth 1 -type -d -exec mkdir -p {}/originalFLAC/Music +
find . -type f -iname "*.flac" -exec ffmpeg -i {} -ab 320k -map_metadata 0 {}.mp3 ;
find . -type f ! -iname "*.flac" | while read file ; do cp -v "$file" "$(dirname "$file")"/originalFLAC/Music/ ; done
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
!
meansnot
. thereforefind . -type f ! -iname "*.flac"
means find all files with name not matching to.flac
(i before name means case insensitive)
– rush
Jan 22 '16 at 16:10
|
show 2 more comments
You can filter it in find
by using -mindepth
option. Like this:
function enterDIR {
find . -mindepth 1-maxdepth 1 -type d | while read DIR ;
do
#recurse into every directory below top-level directory
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
But the whole script doesn't look like a good solution.
If I understand your idea correct, you want to walk through the whole directory tree, create there new directory, convert flac to mp3 if any and copy all non-flac files to a new dir. I would do that this way:
find . -mindepth 1 -type -d -exec mkdir -p {}/originalFLAC/Music +
find . -type f -iname "*.flac" -exec ffmpeg -i {} -ab 320k -map_metadata 0 {}.mp3 ;
find . -type f ! -iname "*.flac" | while read file ; do cp -v "$file" "$(dirname "$file")"/originalFLAC/Music/ ; done
You can filter it in find
by using -mindepth
option. Like this:
function enterDIR {
find . -mindepth 1-maxdepth 1 -type d | while read DIR ;
do
#recurse into every directory below top-level directory
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
But the whole script doesn't look like a good solution.
If I understand your idea correct, you want to walk through the whole directory tree, create there new directory, convert flac to mp3 if any and copy all non-flac files to a new dir. I would do that this way:
find . -mindepth 1 -type -d -exec mkdir -p {}/originalFLAC/Music +
find . -type f -iname "*.flac" -exec ffmpeg -i {} -ab 320k -map_metadata 0 {}.mp3 ;
find . -type f ! -iname "*.flac" | while read file ; do cp -v "$file" "$(dirname "$file")"/originalFLAC/Music/ ; done
edited Jan 22 '16 at 16:01
answered Jan 22 '16 at 15:41
rush
19.1k46194
19.1k46194
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
!
meansnot
. thereforefind . -type f ! -iname "*.flac"
means find all files with name not matching to.flac
(i before name means case insensitive)
– rush
Jan 22 '16 at 16:10
|
show 2 more comments
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
!
meansnot
. thereforefind . -type f ! -iname "*.flac"
means find all files with name not matching to.flac
(i before name means case insensitive)
– rush
Jan 22 '16 at 16:10
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
+1 for giving the actual solution: using find for what it's for and not recurse manually into the directories.
– lgeorget
Jan 22 '16 at 15:50
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
Please demonstrate good practices: mywiki.wooledge.org/DontReadLinesWithFor
– glenn jackman
Jan 22 '16 at 15:56
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
I realize that, but you could take that one extra step
– glenn jackman
Jan 22 '16 at 16:00
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
well, maybe you're right. thx for comment. answer is updated.
– rush
Jan 22 '16 at 16:01
1
1
!
means not
. therefore find . -type f ! -iname "*.flac"
means find all files with name not matching to .flac
(i before name means case insensitive)– rush
Jan 22 '16 at 16:10
!
means not
. therefore find . -type f ! -iname "*.flac"
means find all files with name not matching to .flac
(i before name means case insensitive)– rush
Jan 22 '16 at 16:10
|
show 2 more comments
try replacing this
for DIR in "$(find . -maxdepth 1 -type d)"
with this
for DIR in "$(find . -maxdepth 1 -type d | grep -v ".$")"
.
is interpreted as "any" single character in regex. So it has to be escaped with backslash. Also since all your lines will start with a dot character, you will need to find the line that has the dot and only the dot. Hence the end of line character $
.
at this point, you should not need the if
block below:
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
add a comment |
try replacing this
for DIR in "$(find . -maxdepth 1 -type d)"
with this
for DIR in "$(find . -maxdepth 1 -type d | grep -v ".$")"
.
is interpreted as "any" single character in regex. So it has to be escaped with backslash. Also since all your lines will start with a dot character, you will need to find the line that has the dot and only the dot. Hence the end of line character $
.
at this point, you should not need the if
block below:
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
add a comment |
try replacing this
for DIR in "$(find . -maxdepth 1 -type d)"
with this
for DIR in "$(find . -maxdepth 1 -type d | grep -v ".$")"
.
is interpreted as "any" single character in regex. So it has to be escaped with backslash. Also since all your lines will start with a dot character, you will need to find the line that has the dot and only the dot. Hence the end of line character $
.
at this point, you should not need the if
block below:
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
try replacing this
for DIR in "$(find . -maxdepth 1 -type d)"
with this
for DIR in "$(find . -maxdepth 1 -type d | grep -v ".$")"
.
is interpreted as "any" single character in regex. So it has to be escaped with backslash. Also since all your lines will start with a dot character, you will need to find the line that has the dot and only the dot. Hence the end of line character $
.
at this point, you should not need the if
block below:
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
edited 11 hours ago
nohillside
2,216818
2,216818
answered Jan 22 '16 at 15:33
MelBurslan
5,27011533
5,27011533
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
add a comment |
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
find . -maxdepth 1 -type d -not -name .
– glenn jackman
Jan 22 '16 at 15:37
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f257020%2fhow-can-i-filter-out-current-directory-in-bash%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
One = for [ ...
– Jeff Schaller
Jan 22 '16 at 15:31
Can't you use something like
find . -maxdepth 1 -name "*.flac"
?– pfnuesel
Jan 22 '16 at 15:33
1
You'll want to read mywiki.wooledge.org/BashFAQ/001 -- don't use
for
to iterate over lines.– glenn jackman
Jan 22 '16 at 15:34
I think
find . -type f -name "*.flac"
would suffice. Let find delve into your directories.– glenn jackman
Jan 22 '16 at 15:36