Welcome To Snipplr
Everyone's Recent Snippets Tagged directory
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
currently formatted for use on mediatemple server. replace file path with absolute path of resources.
0
805
posted 13 years ago by dan_hoerr
This function empties the folder recursively. Two parameters are passed in the function, First one is the directory to be emptied and second one is the flag to determine whether to delete the given folder. If set 'true', given folder is also removed...
0
893
posted 13 years ago by nilambar
There are a lot of recursive glob functions out there but they don't build a tree, they build a 1 dimensional array...This function builds a directory tree.
1
725
posted 13 years ago by danoph
There seems to be many scan directory systems but I could not find one that works the way I needed. I added in functionality for a search filter and an ignore list. The search filter and ignore list can ignore by extension, file (case-sensitive file...
1
1141
posted 13 years ago by SoN9ne
A "quick and dirty" way to delete a directory. For more cleaner implementation, see http://www.google.com/codesearch/p?hl=en#SS2by_AKaLs/src/org/apache/commons/io/FileUtils.java&q=cleanDirectory&l=972
0
682
posted 14 years ago by studioevoque
Returns an array of files that match a search term in a certain directory.
1
677
posted 14 years ago by mattkenefick
-print0 and -0 are used to allow for spaces and other wacky chars in directory names
0
629
posted 14 years ago by jfine
Expects all files to be in the current directory; does not recurse into subdirectories. Replace "TEXTTOREMOVE" with the text you wish to remove from the filename. Replace *.csv with a search term appropriate for your situation.
0
1045
posted 14 years ago by powerthru
Execute on the command line. Assumes all files are in the current directory; does not recurse into subdirectories. Replace "*.html" with correct search term for your situation; replace "FS-" with the leading text you wish to remove. This example remo...
0
885
posted 14 years ago by powerthru
Loops through all files of a certain extension in the specified directory. Can be used to list all images in a given directory.
0
892
posted 14 years ago by sandman7OR
Loads of code lifted from here :
http://www.tokeru.com/t/bin/view/Maya/MayaPython#ListDir
0
856
posted 14 years ago by throb
Bash
Bash (Command Line): Loop through directories in specified location, replacing directories in current directory (with backup)
This command line aims at moving directories from a target location to the present working directory (pwd), backing the pwd directories up as it encounters them.
The script works by:
1. Iterating through the contents of the target directory (us...
0
943
posted 14 years ago by karlhorky
This batch mirrors the contents of one directory to another using Robocopy. It will display a list of what is being mirrored before prompting the user for confirmation on the mirror.
WARNING: Robocopy's /MIR switch that is used in this batch WILL...
1
958
posted 14 years ago by karlhorky
Very simple to use.
**Calling:**
$files = dirContents(DIR_PATH, [FILTER, [TYPE]]);
**Examples:**
$files = dirContens("my-dir");
_$files_ is array containing all, both files either directories
$files = dirContens("my-dir",...
0
625
posted 14 years ago by Lostindream
Here is a function you can use to automatically set up a complex folder structure with a specified file mode. All you have to do is create the "root" directory and pass an array describing the folder structure you would like to create in it. If the d...
0
703
posted 14 years ago by chlab