Questions tagged [subdirectory]

A subdirectory is a directory that is contained inside another directory.

A subdirectory is a directory that is contained inside another directory. Directories typically form a hierarchy, or tree structure.

http://en.wikipedia.org/wiki/Folder_(computing)

2633 questions
1972
votes
31 answers

How do I clone a subdirectory only of a Git repository?

I have my Git repository which, at the root, has two sub directories: /finisht /static When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so: svn co…
Nick Sergeant
  • 35,843
  • 12
  • 36
  • 44
930
votes
35 answers

Getting a list of all subdirectories in the current directory

Is there a way to return a list of all the subdirectories in the current directory in Python? I know you can do this with files, but I need to get the list of directories instead.
Brad Zeis
  • 10,085
  • 5
  • 26
  • 20
605
votes
21 answers

Directory-tree listing in Python

How do I get a list of all files (and directories) in a given directory in Python?
Matt
  • 84,419
  • 25
  • 57
  • 67
230
votes
4 answers

How can I create nonexistent subdirectories recursively using Bash?

I am creating a quick backup script that will dump some databases into a nice/neat directory structure and I realized that I need to test to make sure that the directories exist before I create them. The code I have works, but is there a better way…
Topher Fangio
  • 20,372
  • 15
  • 61
  • 94
177
votes
16 answers

PHP Get all subdirectories of a given directory

How can I get all sub-directories of a given directory without files, .(current directory) or ..(parent directory) and then use each directory in a function?
Adrian M.
  • 7,183
  • 15
  • 46
  • 54
163
votes
18 answers

List all files and directories in a directory + subdirectories

I want to list every file and directory contained in a directory and subdirectories of that directory. If I chose C:\ as the directory, the program would get every name of every file and folder on the hard drive that it had access to. A list might…
derp_in_mouth
  • 2,003
  • 4
  • 15
  • 17
145
votes
5 answers

Import module from subfolder

I want to import subfolders as modules. Therefore every subfolder contains a __init__.py. My folder structure is like this: src\ main.py dirFoo\ __init__.py foofactory.py dirFoo1\ __init__.py foo1.py dirFoo2\ …
Razer
  • 7,843
  • 16
  • 55
  • 103
112
votes
10 answers

In Unix, how do you remove everything in the current directory and below it?

I know this will delete everything in a subdirectory and below it: rm -rf But how do you delete everything in the current directory as well as every subdirectory below it and the contents of all of those subdirectories?
Yen
  • 2,176
  • 3
  • 19
  • 27
105
votes
4 answers

Correctly ignore all files recursively under a specific folder except for a specific file type

I have seen similar questions (1, 2 and 3), but I don't get a proper solution from them. I need to ignore all files under a particular folder except for a specific file type. The folder is a subdirectory for the root path. Let me name the folder…
nawfal
  • 70,104
  • 56
  • 326
  • 368
102
votes
6 answers

How to remove .htaccess password protection from a subdirectory

I have password protected my entire website using .htaccess but I would like to expose one of the sub directories so that it can be viewed without a password. How can I disable htaccess password protection for a sub directory? Specifically what is…
justinl
  • 10,448
  • 21
  • 70
  • 88
87
votes
6 answers

How do I get a list of folders and sub folders without the files?

I am trying to print a list of the folders and sub folders of a directory to a file. When I run dir /s/b/o:n > f.txt, I get a list of the files also. I only need the folders and sub folders. Anyone know is this possible to do this from command line…
Inkey
  • 2,189
  • 9
  • 39
  • 64
81
votes
1 answer

Rails 4: organize rails models in sub path without namespacing models?

Would it be possible to have something like this? app/models/ app/models/users/user.rb app/models/users/education.rb The goal is to organize the /app/models folder better, but without having to namespace the models. An unanswered question for Rails…
Rubytastic
  • 15,001
  • 18
  • 87
  • 175
73
votes
7 answers

Browse files and subfolders in Python

I'd like to browse through the current folder and all its subfolders and get all the files with .htm|.html extensions. I have found out that it is possible to find out whether an object is a dir or file like this: import os dirList =…
Blackie123
  • 1,271
  • 4
  • 16
  • 22
70
votes
7 answers

Pick images of root folder from sub-folder

Let's say following is the directory structure of my website : Now in index.html I can simply refer images like: But I want to refer the same image from sub.html. What should be the src?
Moon
  • 19,518
  • 56
  • 138
  • 200
67
votes
2 answers

How to use QMake's subdirs template?

I'm starting to learn Qt. I'm moving from the Visual Studio world and I am looking for a way to organize my project's structure using QMake. I've found the 'subdirs' template but I have quite a hard time understanding it. My project structure…
zarzych
  • 981
  • 1
  • 11
  • 18
1
2 3
99 100