how to get all the files from multiple folders with the same names
There are many folders with the same name on the drive (don't ask how it happened). I want to get the names of all the files from the folders with the same name. The main challenge is the I don't know all the locations of these folders.
D:
folder1/abc/folder_needed/
folder2/qwe/qwe2/folder_needed/
...
folder_zxc/x/y/folder_needed/
I try to do smth like this:
for name in glob.glob('*/folder_needed/*'):
print name
python-3.x glob
add a comment |
There are many folders with the same name on the drive (don't ask how it happened). I want to get the names of all the files from the folders with the same name. The main challenge is the I don't know all the locations of these folders.
D:
folder1/abc/folder_needed/
folder2/qwe/qwe2/folder_needed/
...
folder_zxc/x/y/folder_needed/
I try to do smth like this:
for name in glob.glob('*/folder_needed/*'):
print name
python-3.x glob
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16
add a comment |
There are many folders with the same name on the drive (don't ask how it happened). I want to get the names of all the files from the folders with the same name. The main challenge is the I don't know all the locations of these folders.
D:
folder1/abc/folder_needed/
folder2/qwe/qwe2/folder_needed/
...
folder_zxc/x/y/folder_needed/
I try to do smth like this:
for name in glob.glob('*/folder_needed/*'):
print name
python-3.x glob
There are many folders with the same name on the drive (don't ask how it happened). I want to get the names of all the files from the folders with the same name. The main challenge is the I don't know all the locations of these folders.
D:
folder1/abc/folder_needed/
folder2/qwe/qwe2/folder_needed/
...
folder_zxc/x/y/folder_needed/
I try to do smth like this:
for name in glob.glob('*/folder_needed/*'):
print name
python-3.x glob
python-3.x glob
edited Jan 2 at 19:09
cat_on_the_mat
asked Jan 2 at 18:58
cat_on_the_matcat_on_the_mat
184
184
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16
add a comment |
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16
add a comment |
1 Answer
1
active
oldest
votes
Here's one possible method:
import os
hits =
for dirpath, dirnames, filenames in os.walk('/path/to/your_drive'):
if dirpath.endswith('/folder_needed'):
hits.append((dirpath, filenames))
... this will create a list of directory paths and their contents, like so (this is a partial result from running against /
for paths ending in /bin
):
[
('/home/roundel/projects/zold/bin', ['zold-nohup', 'zold']),
('/home/roundel/projects/monday/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pbr', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/budgeting_app/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/bitcoin/hdwallets/venv/bin', ['pilfont.py', 'pilfile.py', 'tx', 'easy_install-3.4', 'ku', 'pilconvert.py', 'enhancer.py', 'player.py', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pildriver.py', 'pip3.4', 'createfontdatachunk.py', 'viewer.py', 'pilprint.py', 'activate.csh', 'painter.py', 'activate', 'block', 'gifmaker.py', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'explode.py', 'activate.fish', 'easy_install', 'thresholder.py', 'qr', 'genwallet']),
('/home/roundel/projects/crypto_hivemind/venv/bin', ['tx', 'easy_install-3.4', 'ku', 'flask', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pip3.4', 'activate.csh', 'activate', 'block', 'raven', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'activate.fish', 'easy_install', 'genwallet']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/14.0/bin', ['Microsoft.Build.Tasks.Core.dll', 'xbuild.exe', 'Microsoft.Build.dll', 'Microsoft.Build.Utilities.Core.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/12.0/bin', ['Microsoft.Build.Utilities.v12.0.dll', 'xbuild.exe', 'Microsoft.Build.Tasks.v12.0.dll', 'Microsoft.Build.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/msbuild/15.0/bin', ),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/bin', ['cli', 'monobin-env', 'pedump', 'mono-env', 'mono']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/Tools/nodejs/bin', ['npm', 'node']),
]
Since I imagine the directory name you're searching for is considerably less common than /bin
, you'll probably have more useful results.
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%2f54011734%2fhow-to-get-all-the-files-from-multiple-folders-with-the-same-names%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
Here's one possible method:
import os
hits =
for dirpath, dirnames, filenames in os.walk('/path/to/your_drive'):
if dirpath.endswith('/folder_needed'):
hits.append((dirpath, filenames))
... this will create a list of directory paths and their contents, like so (this is a partial result from running against /
for paths ending in /bin
):
[
('/home/roundel/projects/zold/bin', ['zold-nohup', 'zold']),
('/home/roundel/projects/monday/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pbr', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/budgeting_app/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/bitcoin/hdwallets/venv/bin', ['pilfont.py', 'pilfile.py', 'tx', 'easy_install-3.4', 'ku', 'pilconvert.py', 'enhancer.py', 'player.py', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pildriver.py', 'pip3.4', 'createfontdatachunk.py', 'viewer.py', 'pilprint.py', 'activate.csh', 'painter.py', 'activate', 'block', 'gifmaker.py', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'explode.py', 'activate.fish', 'easy_install', 'thresholder.py', 'qr', 'genwallet']),
('/home/roundel/projects/crypto_hivemind/venv/bin', ['tx', 'easy_install-3.4', 'ku', 'flask', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pip3.4', 'activate.csh', 'activate', 'block', 'raven', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'activate.fish', 'easy_install', 'genwallet']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/14.0/bin', ['Microsoft.Build.Tasks.Core.dll', 'xbuild.exe', 'Microsoft.Build.dll', 'Microsoft.Build.Utilities.Core.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/12.0/bin', ['Microsoft.Build.Utilities.v12.0.dll', 'xbuild.exe', 'Microsoft.Build.Tasks.v12.0.dll', 'Microsoft.Build.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/msbuild/15.0/bin', ),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/bin', ['cli', 'monobin-env', 'pedump', 'mono-env', 'mono']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/Tools/nodejs/bin', ['npm', 'node']),
]
Since I imagine the directory name you're searching for is considerably less common than /bin
, you'll probably have more useful results.
add a comment |
Here's one possible method:
import os
hits =
for dirpath, dirnames, filenames in os.walk('/path/to/your_drive'):
if dirpath.endswith('/folder_needed'):
hits.append((dirpath, filenames))
... this will create a list of directory paths and their contents, like so (this is a partial result from running against /
for paths ending in /bin
):
[
('/home/roundel/projects/zold/bin', ['zold-nohup', 'zold']),
('/home/roundel/projects/monday/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pbr', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/budgeting_app/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/bitcoin/hdwallets/venv/bin', ['pilfont.py', 'pilfile.py', 'tx', 'easy_install-3.4', 'ku', 'pilconvert.py', 'enhancer.py', 'player.py', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pildriver.py', 'pip3.4', 'createfontdatachunk.py', 'viewer.py', 'pilprint.py', 'activate.csh', 'painter.py', 'activate', 'block', 'gifmaker.py', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'explode.py', 'activate.fish', 'easy_install', 'thresholder.py', 'qr', 'genwallet']),
('/home/roundel/projects/crypto_hivemind/venv/bin', ['tx', 'easy_install-3.4', 'ku', 'flask', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pip3.4', 'activate.csh', 'activate', 'block', 'raven', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'activate.fish', 'easy_install', 'genwallet']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/14.0/bin', ['Microsoft.Build.Tasks.Core.dll', 'xbuild.exe', 'Microsoft.Build.dll', 'Microsoft.Build.Utilities.Core.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/12.0/bin', ['Microsoft.Build.Utilities.v12.0.dll', 'xbuild.exe', 'Microsoft.Build.Tasks.v12.0.dll', 'Microsoft.Build.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/msbuild/15.0/bin', ),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/bin', ['cli', 'monobin-env', 'pedump', 'mono-env', 'mono']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/Tools/nodejs/bin', ['npm', 'node']),
]
Since I imagine the directory name you're searching for is considerably less common than /bin
, you'll probably have more useful results.
add a comment |
Here's one possible method:
import os
hits =
for dirpath, dirnames, filenames in os.walk('/path/to/your_drive'):
if dirpath.endswith('/folder_needed'):
hits.append((dirpath, filenames))
... this will create a list of directory paths and their contents, like so (this is a partial result from running against /
for paths ending in /bin
):
[
('/home/roundel/projects/zold/bin', ['zold-nohup', 'zold']),
('/home/roundel/projects/monday/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pbr', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/budgeting_app/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/bitcoin/hdwallets/venv/bin', ['pilfont.py', 'pilfile.py', 'tx', 'easy_install-3.4', 'ku', 'pilconvert.py', 'enhancer.py', 'player.py', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pildriver.py', 'pip3.4', 'createfontdatachunk.py', 'viewer.py', 'pilprint.py', 'activate.csh', 'painter.py', 'activate', 'block', 'gifmaker.py', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'explode.py', 'activate.fish', 'easy_install', 'thresholder.py', 'qr', 'genwallet']),
('/home/roundel/projects/crypto_hivemind/venv/bin', ['tx', 'easy_install-3.4', 'ku', 'flask', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pip3.4', 'activate.csh', 'activate', 'block', 'raven', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'activate.fish', 'easy_install', 'genwallet']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/14.0/bin', ['Microsoft.Build.Tasks.Core.dll', 'xbuild.exe', 'Microsoft.Build.dll', 'Microsoft.Build.Utilities.Core.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/12.0/bin', ['Microsoft.Build.Utilities.v12.0.dll', 'xbuild.exe', 'Microsoft.Build.Tasks.v12.0.dll', 'Microsoft.Build.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/msbuild/15.0/bin', ),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/bin', ['cli', 'monobin-env', 'pedump', 'mono-env', 'mono']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/Tools/nodejs/bin', ['npm', 'node']),
]
Since I imagine the directory name you're searching for is considerably less common than /bin
, you'll probably have more useful results.
Here's one possible method:
import os
hits =
for dirpath, dirnames, filenames in os.walk('/path/to/your_drive'):
if dirpath.endswith('/folder_needed'):
hits.append((dirpath, filenames))
... this will create a list of directory paths and their contents, like so (this is a partial result from running against /
for paths ending in /bin
):
[
('/home/roundel/projects/zold/bin', ['zold-nohup', 'zold']),
('/home/roundel/projects/monday/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pbr', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/budgeting_app/venv/bin', ['easy_install-3.4', 'flask', 'activate_this.py', 'python3', 'pip', 'gunicorn', 'python-config', 'pip3', 'pip3.4', 'gunicorn_paster', 'activate.csh', 'activate', 'raven', 'python3.4', 'python', 'wheel', 'activate.fish', 'easy_install']),
('/home/roundel/projects/bitcoin/hdwallets/venv/bin', ['pilfont.py', 'pilfile.py', 'tx', 'easy_install-3.4', 'ku', 'pilconvert.py', 'enhancer.py', 'player.py', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pildriver.py', 'pip3.4', 'createfontdatachunk.py', 'viewer.py', 'pilprint.py', 'activate.csh', 'painter.py', 'activate', 'block', 'gifmaker.py', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'explode.py', 'activate.fish', 'easy_install', 'thresholder.py', 'qr', 'genwallet']),
('/home/roundel/projects/crypto_hivemind/venv/bin', ['tx', 'easy_install-3.4', 'ku', 'flask', 'activate_this.py', 'python3', 'pip', 'spend', 'python-config', 'pip3', 'pip3.4', 'activate.csh', 'activate', 'block', 'raven', 'fetch_unspent', 'python3.4', 'cache_tx', 'python', 'bu', 'wheel', 'activate.fish', 'easy_install', 'genwallet']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/14.0/bin', ['Microsoft.Build.Tasks.Core.dll', 'xbuild.exe', 'Microsoft.Build.dll', 'Microsoft.Build.Utilities.Core.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/xbuild/12.0/bin', ['Microsoft.Build.Utilities.v12.0.dll', 'xbuild.exe', 'Microsoft.Build.Tasks.v12.0.dll', 'Microsoft.Build.dll', 'xbuild.pdb', 'Microsoft.Build.Engine.dll', 'Microsoft.CSharp.targets', 'Microsoft.Common.tasks', 'Microsoft.VisualBasic.targets', 'Mono.XBuild.Tasks.dll', 'xbuild.rsp', 'xbuild.exe.config', 'Microsoft.Build.Framework.dll', 'Microsoft.Build.xsd', 'Microsoft.Common.targets']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/lib/mono/msbuild/15.0/bin', ),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/MonoBleedingEdge/bin', ['cli', 'monobin-env', 'pedump', 'mono-env', 'mono']),
('/home/roundel/Unity-2018.2.7f1/Editor/Data/Tools/nodejs/bin', ['npm', 'node']),
]
Since I imagine the directory name you're searching for is considerably less common than /bin
, you'll probably have more useful results.
answered Jan 2 at 19:27


HugoHugo
38929
38929
add a comment |
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%2f54011734%2fhow-to-get-all-the-files-from-multiple-folders-with-the-same-names%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
Start from root (that you target) and recursively traverse through the file system. Check if it is a directory or a file. If it is a directory then check for its name and read the name of all the files inside it using glob module.
– hygull
Jan 2 at 19:16