FAKE - F# Make - A DSL for build tasks and more FAKE
6.1.3

Lookig for older versions of the documentation, pre FAKE v6? See 

v5.fake.build

Shell Module

Shell-like functions. Similar to Ruby's FileUtils.

Types

Type Description

CopyRecursiveMethod

Copying methods

Functions and values

Function or value Description

Shell.appendTextFiles newFileName files

Full Usage: Shell.appendTextFiles newFileName files

Parameters:
    newFileName : string - The target FileName.
    files : seq<string> - The original FileNames as a sequence.

Appends all given files to one file.

newFileName : string

The target FileName.

files : seq<string>

The original FileNames as a sequence.

Shell.appendTextFilesWithEncoding encoding newFileName files

Full Usage: Shell.appendTextFilesWithEncoding encoding newFileName files

Parameters:
    encoding : Encoding - The encoding to use.
    newFileName : string - The target FileName.
    files : seq<string> - The original FileNames as a sequence.

Appends all given files to one file.

encoding : Encoding

The encoding to use.

newFileName : string

The target FileName.

files : seq<string>

The original FileNames as a sequence.

Shell.cd path

Full Usage: Shell.cd path

Parameters:
    path : string - The path to directory to change to

Changes working directory

path : string

The path to directory to change to

Shell.chdir path

Full Usage: Shell.chdir path

Parameters:
    path : string - The path to directory to change to

Changes working directory

path : string

The path to directory to change to

Shell.cleanDir path

Full Usage: Shell.cleanDir path

Parameters:
    path : string - The directory path

Cleans a directory by removing all files and sub-directories

path : string

The directory path

Shell.cleanDirs dirs

Full Usage: Shell.cleanDirs dirs

Parameters:
    dirs : seq<string> - The directories to clean

Cleans multiple directories

dirs : seq<string>

The directories to clean

Shell.compareFiles delete originalFileName compareFileName

Full Usage: Shell.compareFiles delete originalFileName compareFileName

Parameters:
    delete : bool - Mark if to delete same files or not
    originalFileName : string - Original directory to use in comparision
    compareFileName : string - Other directory to use in comparision

Returns: bool

Compares the given files for changes. If delete is set to true then equal files will be removed.

delete : bool

Mark if to delete same files or not

originalFileName : string

Original directory to use in comparision

compareFileName : string

Other directory to use in comparision

Returns: bool

Shell.copy target files

Full Usage: Shell.copy target files

Parameters:
    target : string - The target directory.
    files : seq<string> - The original file names as a sequence.

Copies the files to the target.

target : string

The target directory.

files : seq<string>

The original file names as a sequence.

Shell.copyCached target cacheDir files

Full Usage: Shell.copyCached target cacheDir files

Parameters:
    target : string - The target FileName.
    cacheDir : string - The cache directory.
    files : seq<string> - The original files.

Returns: string list

Copies the files from a cache folder. If the files are not cached or the original files have a different write time the cache will be refreshed.

target : string

The target FileName.

cacheDir : string

The cache directory.

files : seq<string>

The original files.

Returns: string list

Shell.copyDir target source filterFile

Full Usage: Shell.copyDir target source filterFile

Parameters:
    target : string - The target directory
    source : string - The source directory
    filterFile : string -> bool - A file filter predicate

Copies a directory recursively. If the target directory does not exist, it will be created

target : string

The target directory

source : string

The source directory

filterFile : string -> bool

A file filter predicate

Shell.copyFile target fileName

Full Usage: Shell.copyFile target fileName

Parameters:
    target : string - The target directory or file.
    fileName : string - The FileName.

Copies a single file to the target and overwrites the existing file.

target : string

The target directory or file.

fileName : string

The FileName.

Shell.copyFileIntoSubFolder target fileName

Full Usage: Shell.copyFileIntoSubFolder target fileName

Parameters:
    target : string - The target directory
    fileName : string - The FileName.

Copies a single file to a relative subfolder of the target.

target : string

The target directory

fileName : string

The FileName.

Shell.copyFileWithSubfolder baseDir target fileName

Full Usage: Shell.copyFileWithSubfolder baseDir target fileName

Parameters:
    baseDir : string - The base directory.
    target : string - The target directory.
    fileName : string - The file name.

Copies a single file to the target folder preserving the folder structure starting from the specified base folder.

baseDir : string

The base directory.

target : string

The target directory.

fileName : string

The file name.

Shell.copyFiles target files

Full Usage: Shell.copyFiles target files

Parameters:
    target : string - The target directory.
    files : seq<string> - The original file names.

Copies the files to the target - Alias for Copy

target : string

The target directory.

files : seq<string>

The original file names.

Shell.copyFilesWithSubFolder targetDir files

Full Usage: Shell.copyFilesWithSubFolder targetDir files

Parameters:
    targetDir : string - The target directory.
    files : IGlobbingPattern - The file names.

Copies the given glob-matches into another directory by leaving relative paths in place based on the globbing base-directory

targetDir : string

The target directory.

files : IGlobbingPattern

The file names.

Example


 !! "**/My*Glob*.exe"
      |> GlobbingPattern.setBaseDir "baseDir"
      |> Shell.copyFilesWithSubFolder "targetDir"

Shell.copyRecursive dir outputDir overWrite

Full Usage: Shell.copyRecursive dir outputDir overWrite

Parameters:
    dir : string - Directory path to copy
    outputDir : string - The target directory to copy to
    overWrite : bool - Flag to overwrite any matching files/directories or not

Returns: string list

Copies the file structure recursively.

dir : string

Directory path to copy

outputDir : string

The target directory to copy to

overWrite : bool

Flag to overwrite any matching files/directories or not

Returns: string list

Shell.copyRecursive2 method dir outputDir

Full Usage: Shell.copyRecursive2 method dir outputDir

Parameters:
    method : CopyRecursiveMethod - The method to decide which files get copied
    dir : string - The source directory.
    outputDir : string - The target directory.

Returns: string list

Copies the file structure recursively.

method : CopyRecursiveMethod

The method to decide which files get copied

dir : string

The source directory.

outputDir : string

The target directory.

Returns: string list

Shell.copyRecursiveTo overWrite outputDir dir

Full Usage: Shell.copyRecursiveTo overWrite outputDir dir

Parameters:
    overWrite : bool - Flag to overwrite any matching files/directories or not
    outputDir : string - The target directory to copy to
    dir : string - Directory path to copy

Returns: string list
Modifiers: inline

Copies the file structure recursively.

overWrite : bool

Flag to overwrite any matching files/directories or not

outputDir : string

The target directory to copy to

dir : string

Directory path to copy

Returns: string list

Shell.copyTo target files

Full Usage: Shell.copyTo target files

Parameters:
    target : string - The target directory.
    files : seq<string> - The original file names as a sequence.

Copies the given files to the target.

target : string

The target directory.

files : seq<string>

The original file names as a sequence.

Shell.cp src dest

Full Usage: Shell.cp src dest

Parameters:
    src : string - The source
    dest : string - The destination

Like "cp" in a shell. Copies a single file.

src : string

The source

dest : string

The destination

Shell.cp_r src dest

Full Usage: Shell.cp_r src dest

Parameters:
    src : string - The source
    dest : string - The destination

Like "cp -r" in a shell. Copies a file or directory recursively.

src : string

The source

dest : string

The destination

Shell.deleteDir dir

Full Usage: Shell.deleteDir dir

Parameters:
    dir : string - The directory path to delete

Delete a directory

dir : string

The directory path to delete

Shell.deleteDirs dirs

Full Usage: Shell.deleteDirs dirs

Parameters:
    dirs : seq<string> - The directories to delete

Deletes multiple directories

dirs : seq<string>

The directories to delete

Shell.generatePatch lastReleaseDir patchDir srcFiles

Full Usage: Shell.generatePatch lastReleaseDir patchDir srcFiles

Parameters:
    lastReleaseDir : string - The directory of the last release.
    patchDir : string - The target directory.
    srcFiles : seq<string> - The source files.

Checks the srcFiles for changes to the last release.

lastReleaseDir : string

The directory of the last release.

patchDir : string

The target directory.

srcFiles : seq<string>

The source files.

Shell.generatePatchWithFindOldFileFunction lastReleaseDir patchDir srcFiles findOldFileF

Full Usage: Shell.generatePatchWithFindOldFileFunction lastReleaseDir patchDir srcFiles findOldFileF

Parameters:
    lastReleaseDir : string - The directory of the last release
    patchDir : string - The target directory
    srcFiles : seq<string> - The source files
    findOldFileF : string -> string -> string - A function which finds the old file

Checks the srcFiles for changes to the last release.

lastReleaseDir : string

The directory of the last release

patchDir : string

The target directory

srcFiles : seq<string>

The source files

findOldFileF : string -> string -> string

A function which finds the old file

Shell.mkdir path

Full Usage: Shell.mkdir path

Parameters:
    path : string - The path to create directory in

Creates a directory if it doesn't exist.

path : string

The path to create directory in

Shell.moveFile target fileName

Full Usage: Shell.moveFile target fileName

Parameters:
    target : string - The target directory.
    fileName : string - The FileName.

Moves a single file to the target and overwrites the existing file. If fileName is a directory the functions does nothing.

target : string

The target directory.

fileName : string

The FileName.

Shell.mv src dest

Full Usage: Shell.mv src dest

Parameters:
    src : string - The source
    dest : string - The destination

Like "mv" in a shell. Moves/renames a file

src : string

The source

dest : string

The destination

Shell.popd ()

Full Usage: Shell.popd ()

Parameters:
    () : unit

Restore the previous directory stored in the stack

() : unit

Shell.pushd path

Full Usage: Shell.pushd path

Parameters:
    path : string - The path to directory to push

Store the current directory in the directory stack before changing to a new one

path : string

The path to directory to push

Shell.pwd ()

Full Usage: Shell.pwd ()

Parameters:
    () : unit

Returns: string

Gets working directory

() : unit
Returns: string

Shell.regexReplaceInFileWithEncoding pattern replacement encoding file

Full Usage: Shell.regexReplaceInFileWithEncoding pattern replacement encoding file

Parameters:
    pattern : string - The string to search for a match
    replacement : string - The replacement string
    encoding : Encoding - The encoding to use when reading and writing the file
    file : string - The path of the file to process

Replace all occurrences of the regex pattern with the given replacement in the specified file

pattern : string

The string to search for a match

replacement : string

The replacement string

encoding : Encoding

The encoding to use when reading and writing the file

file : string

The path of the file to process

Shell.regexReplaceInFilesWithEncoding pattern replacement encoding files

Full Usage: Shell.regexReplaceInFilesWithEncoding pattern replacement encoding files

Parameters:
    pattern : string - The string to search for a match
    replacement : string - The replacement string
    encoding : Encoding - The encoding to use when reading and writing the files
    files : seq<string> - The paths of the files to process

Replace all occurrences of the regex pattern with the given replacement in the specified files

pattern : string

The string to search for a match

replacement : string

The replacement string

encoding : Encoding

The encoding to use when reading and writing the files

files : seq<string>

The paths of the files to process

Shell.rename target fileName

Full Usage: Shell.rename target fileName

Parameters:
    target : string - The target file or directory name.
    fileName : string - The original file or directory name.

Renames the file or directory to the target name.

target : string

The target file or directory name.

fileName : string

The original file or directory name.

Shell.replaceInFiles replacements files

Full Usage: Shell.replaceInFiles replacements files

Parameters:
    replacements : seq<string * string> - A sequence of tuples with the patterns and the replacements.
    files : seq<string> - The files to process.

Replaces all occurrences of the patterns in the given files with the given replacements.

replacements : seq<string * string>

A sequence of tuples with the patterns and the replacements.

files : seq<string>

The files to process.

Shell.rm fileName

Full Usage: Shell.rm fileName

Parameters:
    fileName : string - The file name to delete

Deletes a file if it exists

fileName : string

The file name to delete

Shell.rm_rf f

Full Usage: Shell.rm_rf f

Parameters:
    f : string - The file name to delete

Like "rm -rf" in a shell. Removes files recursively, ignoring non-existing files

f : string

The file name to delete

Shell.silentCopy target files

Full Usage: Shell.silentCopy target files

Parameters:
    target : string - The target directory.
    files : seq<string> - List of files to copy.

Copies a list of files to the specified directory without any output.

target : string

The target directory.

files : seq<string>

List of files to copy.

Shell.testDir path

Full Usage: Shell.testDir path

Parameters:
    path : string - Directory path to check

Returns: bool

Checks if the directory exists

path : string

Directory path to check

Returns: bool

Shell.testFile path

Full Usage: Shell.testFile path

Parameters:
    path : string - Directory path to check

Returns: bool

Checks if the file exists

path : string

Directory path to check

Returns: bool

Shell.writeConfigFile configFileName parameters

Full Usage: Shell.writeConfigFile configFileName parameters

Parameters:
    configFileName : string - The configuration file name
    parameters : seq<'a * 'b> - The parameters to write to config file

Creates a config file with the parameters as "key;value" lines

configFileName : string

The configuration file name

parameters : seq<'a * 'b>

The parameters to write to config file