FAQ Database Discussion Community


Add all whitelisted directories to an index

git,whitelist,subdirectories
A git repository contains two directories: A and B1. This is the directory structure: $ find -name "*.*" -print ./.git/hooks/applypatch-msg.sample ./.git/hooks/commit-msg.sample ./.git/hooks/post-update.sample ./.git/hooks/pre-applypatch.sample ./.git/hooks/pre-commit.sample ./.git/hooks/pre-push.sample ./.git/hooks/pre-rebase.sample ./.git/hooks/prepare-commit-msg.sample ./.git/hooks/update.sample ./A/a.txt ./A/A1/a1.txt ./B/b.txt ./B/B1/b1.txt ./C/c.txt This is the .gitignore file, it whitelists directories A and B1: $ more .gitignore #...

Recurse through selected level of subdirectories

python,traversal,subdirectories
I am new to python. I have the following piece of code which works well by retrieving selected directories into a list for me. But because there are quite a lot of sub-directories and files, the code is rather slow, compared to the Perl code which I have upgraded it...

Recursively expand and search pattern of specific subdirectories

python,path,filepath,subdirectories,wildcard-expansion
I'm looking for an option to search specific subdirectories in python. For instance a directory structure like this: some_files/ common/ 2009/ 2010/ 2011/ ... I only want to search for in the subdirectories that start with a 2, so that it must be something like 'some_files/2*'. I think it must...

In Python, how do I remove subdirectories that do NOT contain a certain file extension (ie .pdf)?

python,python-2.7,subdirectories,os.walk
I'm trying to write a program that physically removes all subdirectories of a directory that do not have any .pdf files in them. I think the solution requires os.walk but haven't figured out much. I made a recursive function to do this but I'm not sure if it works def...

Win7 Batch File - Moving Subfolders(& Files) to Grand-Parent Directory

batch-file,cmd,merge,move,subdirectories
I have a somewhat complicated problem. I've downloaded an archived website from archive.org using Httrack and now I have thousands of subfolders and files I need to merge before I can rebuild it. I'm trying to write a batch file to solve the problem. But my search results never come...

Apache - Serve all files in subdirectories

apache,mod-rewrite,alias,subdirectories
My server acts as a personal file share. I would like to set up a folder, _misc, which contains random files. Further, I need extra folders inside _misc to act as categories for files. What I've been trying to do these last couple nights is configure it in such a...