Python: select only folders in a directory - python-2.7

I am wondering about a good way to isolate just the folders in any given directory. Right now I have a folder with both, folders and random files in it and I want to isolate just the folders and ignore the files, whatever they may be called. Is there a quick way to do this in python?
Cheers

This may be a duplicate question. Please check out this link and see if it serves your purpose :
How to list only top level directories in Python?

Related

Trouble creating custom folders in CodeBlocks

I am have a lot of trouble with CodeBlocks currently that is leaving me really frustrated. Basically, all I want to do is create my own folders within code blocks, and move my files into them.
Currently I am using default settings which forces file types into their own kind of virtual folder. I have a Sources folder with all of my .cpp files, and a Headers folder with all of my .h folders. All I want is a traditional layout.
For example, it is currently impossible for me to create a folder called Input which has both my input cpp and h files. While I looked online, I found an example where someone had this set up which has actual folders, where this is my current set up. Sources and Headers only exists in editor, and not in my actual folders. Do you have any idea how to fix this? I am trying to follow some tutorials that require the creation of folders : /
Thank you!

Including files from another folders in eclipse

I've ordered a bit my structure of classes and moved the related ones to more specific folders. The problem is that now the includes I made are not being able to find the class, as right now is in another folder.
Why is it not looking automatically for the file through all the folders?
I shouldn't have to write #include "Gameplay/TestMap.hpp". How can I avoid this?
Thanks
You can find how to add paths in eclipse Help

How can I rename multiple files in Eclipse?

I'd like to rename multiple files(/resources) in Eclipse.
Functionality by order of usefulness:
Rename files in search results (i.e. search for pattern, see which files match
Rename files using a regexp which runs on all filenames (e.g. s/stuff(.*)\.c/stuff\1.c.old/)
Rename files in the selection in the package explorer (F2 doesn't do this...)
How can I do this? Is there a relevant add-on maybe?
May be you can use Jalopy, unfortunately its not free. Am not sure how usefull it can be in your case.

Cleaning up a VC++ 6 project

I'm working with a very old and large VC6++ project and it's all messed up. There are unused files and folders everywhere, copies of folders and it's just a mess to clean it up by hand in its current state.
It will be done eventually, but is there any simple way to check what files and folders are used when it does a clean compile?
The project settings doesnt help me at all because it simply uses copies of folders and additional include directories.
Any suggestions?
Well, if you want to parse the compiler output you can get which files are actually used. I also find this when googling around, you might want to try (I haven't tried it myself). My way would be to clean the build, list all source files, build, and for each source find its corresponding .obj. The ones without .obj are not used. Note that this only works for source files, unused header files stay undetected.
VC6 will produce a makefile for you:
http://msdn.microsoft.com/en-us/library/aa233950%28v=vs.60%29.aspx
You can use the generated makefile (and the associated .dep file) as a starting point and edit it down to the list of files that get used in a build.
This will let you see the header files that the project depends on in addition to the .c/.cpp/.lib files that might show in the build log. One thing to keep in mind is that you'll probably also want to make sure you track the .dsw and .dsp workspace and project files.
If you're a bit adventurous, you might be able to convince the makefile to actually copy the source files to some other location for you with an appropriate override of the certain macros and/or dependencies. But that would probably be more trouble than it's worth for a one-time effort.
Finally, there's a commercial product, CopyWiz by Kinook Software, that seems to have features that might do what you're looking for (and it supports VC++ 6). Note: I'm not sure if it will do what you want, but it may be worth a look.
Yes. Run Process Monitor from SysInternals. It can capture all file system events and filter them based on the path and other factors.
So, set the filter to the root of your source tree, only succesfull file reads (VC looks for headers in many places), and build your project. You'll probably still see several thousand events. So, save them to file, sort by path, and remove duplicate paths (headers especially will have many duplicate entries)

Should I add .vcxproj.filter files to source control?

While evaluating Visual Studio 2010 Beta 2, I see that in the converted directory, my vcproj files became vcxproj files. There are also vcxproj.filter files alongside each project which appear to contain a description of the folder structure (\Source Files, \Header Files, etc.).
Do you think these filter files should be kept per-user, or should they be shared across the whole dev group and checked into SCC?
My current thinking is to check them in, but I wonder if there are any reasons not to do that, or perhaps good reasons why I should definitely check them in.
The obvious benefit is that the folder structures will match if I'm looking at someone else's machine, but maybe they'd like to reorganize things logically?
We intentionally pulled the .filter. file information out of the .vcproj when we translated to the .vcxproj MSBuild format.
One reason is exactly what you pointed out, that the filters are purely a logical view, and different team members may want different views.
The other is that sometimes the build is set up to check the timestamp of the project file, and trigger a rebuild if it has changed - because that may mean there are different source files to build, or different settings, etc. I don't recall if we actually shipped with the build trigging that way, but the idea was that we did not want to trigger a rebuild simply because the filters changed, as they don't affect the build.
Previous versions of Visual Studio (at least versions 6.0 and 2008) store that information in their own project file (.dsp and .vcproj files respectively), which of course is good to add to SCC.
I cannot think of any reason to not include this .filter files in SCC
I just found that if you use Git you can mark .filter files to be treated as a union for merging to make it simpler. Just add the line:
*.vcxproj.filters merge=union
to your .gitattributes file.
See Using .gitattributes to avoid merge conflicts for more details.
It should not be added in case you use CMake (or similar build tools) to generate files like *.sln, *.vcxproj, *.vcxproj.filters etc., because this files may contain full path to your Project Folder and other only your computer's specific folders.