Can I move the .git directory for a repo to it’s parent directory?

You can do what you are describing like this: Move the content of ABC to an ABC/ subdirectory, and fix the history so that it looks like it has always been there: $ cd /path/to/ABC $ git filter-branch –index-filter \ ‘git ls-files -s | sed “s-\t-&ABC/-” | GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ git update-index –index-info && mv $GIT_INDEX_FILE.new … Read more

Iterate through folders, then subfolders and print filenames with path to text file

Charles’ answer is good, but can be improved upon to increase speed and efficiency. Each item produced by os.walk() (See docs) is a tuple of three items. Those items are: The working directory A list of strings naming any sub-directories present in the working directory A list of files present in the working directory Knowing … Read more

Best way to iterate folders and subfolders

If you’re using .NET 4, you may wish to use the System.IO.DirectoryInfo.EnumerateDirectories and System.IO.DirectoryInfo.EnumerateFiles methods. If you use the Directory.GetFiles method as other posts have recommended, the method call will not return until it has retrieved ALL the entries. This could take a long time if you are using recursion. From the documentation: The EnumerateFilesand … Read more

C# Remove all empty subdirectories

Using C# Code. static void Main(string[] args) { processDirectory(@”c:\temp”); } private static void processDirectory(string startLocation) { foreach (var directory in Directory.GetDirectories(startLocation)) { processDirectory(directory); if (Directory.GetFiles(directory).Length == 0 && Directory.GetDirectories(directory).Length == 0) { Directory.Delete(directory, false); } } }

How to install Laravel 4 to a web host subfolder without publicly exposing /app/ folder?

So I figured out how to do this. I’ll explain with an example. Suppose you a domain, http://domain.example. Here’s an example of the structure you might be using: domain.example/ (the root of your web hosting) |– yourlaravel4_base/ |– [some other folders…] |– public_html/ (where your html files and such go) | |– [some other folders…] … Read more

How to use QMake’s subdirs template?

In addition to Troubadour’s comment, I would note that the SUBDIRS target is only good for specifying subdirectories. Therefore, your extra line of SOURCES += main.cpp in your project.pro file is incorrect, and will likely fail to build your main.cpp file, at worst. At best, qmake will refuse to parse the file, since it has … Read more