Tutorial by Examples: directory

package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { panic(err) } fmt.Println("Folders in the current directory:") for _, fileInfo := range files { ...
Early bound (requires a reference to Microsoft Scripting Runtime): Public Sub EnumerateDirectory() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject Dim targetFolder As Folder Set targetFolder = fso.GetFolder("C:\") Dim foundFi...
It is considered good practice to use a prefix when creating git archives, so that extraction will place all files inside a directory. To create an archive of HEAD with a directory prefix: git archive --output=archive-HEAD.zip --prefix=src-directory-name HEAD When extracted all the files will be...
It is also possible to create archives of other items than HEAD, such as branches, commits, tags, and directories. To create an archive of a local branch dev: git archive --output=archive-dev.zip --prefix=src-directory-name dev To create an archive of a remote branch origin/dev: git archive --...
The first thing you need to know when structuring your apps is that the Meteor tool has some directories that are hard-coded with specific logic. At a very basic level, the following directories are "baked in" the Meteor bundler. client/ # client applicati...
Many people find themselves eventually supporting multiple applications, and desire to share code between apps. This leads to the concept of microservice architecture, and all-package apps. Essentially, the code from the entire classic directory structure is refactored out into packages. Even tho...
The most recent versions of Meteor ship with support for ecmascript, aka ES6 or ES2015. Instead of packages, Javascript now supports import statements and modules, which replaces the need for package-only applications. The latest directory structure is similar to the package-only structure, but us...
And, of course, you can mix these approaches, and use both packages and imports along side your application specific code. A mix-mode structure is most common in three situations: a franken-app, which is just sort of pulling a bit from here-and-there without any overall strategy; an app that's bei...
Using GNU grep grep -r 'pattern' <directory path> To also list line numbers of matches use -n option grep -rn 'pattern' <directory path> To search only files with particular glob pattern grep --include='*.txt' -r 'pattern' <directory path> Exclude file patterns or direc...
There are use cases when you might want to rename your app directory to something else. In Laravel4 you could just change a config entry, here's one way to do it in Laravel5. In this example we'll be renaming the app directory to src. Override Application class The directories name app is hardcod...
if we want to change the Controllers directory we need: Move and/or rename the default Controllers directory where we want it. For example from app/Http/Controllers to app/Controllers Update all the namespaces of the files inside the Controllers folder, making they adhere to the new path, re...
If you want to add all the JARs in directory to the classpath, you can do this concisely using classpath wildcard syntax; for example: someFolder/* This tells the JVM to add all JAR and ZIP files in the someFolder directory to the classpath. This syntax can be used in a -cp argument, a CLASSPA...
for /r command can be used to recursively visit all the directories in a directory tree and perform a command. @echo off rem start at the top of the tree to visit and loop though each directory for /r %%a in (.) do ( rem enter the directory pushd %%a echo In directory: cd rem leave...
The following uses a variable with a for loop to rename a group of files. SetLocal EnableDelayedExpansion for %%j in (*.*) do ( set filename=%%~nj set filename=!filename:old=new! set filename=Prefix !filename! set filename=!filename! Suffix ren "%%j" "!filename!%%~x...
Enabled directory index means that if someone access to any folder which don't contains index.php , index.html, index.htm or any other default file defined in DirectoryIndex in apache configuration then all files in that folder will be listed in browser if you try to visit that page. Often director...
public void iterate(final String dirPath) throws IOException { final DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get(dirPath)); for (final Path path : paths) { if (Files.isDirectory(path)) { System.out.println(path.getFileName()); } } ...
os.mkdir('newdir') If you need to specify permissions, you can use the optional mode argument: os.mkdir('newdir', mode=0700)
Use the os.getcwd() function: print(os.getcwd())
Remove the directory at path: os.rmdir(path) You should not use os.remove() to remove a directory. That function is for files and using it on directories will result in an OSError
Given a local directory with the following contents: └── dir1 ├── subdir1 └── subdir2 We want to create the same subdir1, subdir2 under a new directory dir2, which does not exist yet. import os os.makedirs("./dir2/subdir1") os.makedirs("./dir2/subdir2") R...

Page 2 of 5