-
Notifications
You must be signed in to change notification settings - Fork 8
File Task
The File
task manages files. Pass the path to one or more files to the Path
property. If you pass a path to a file that doesn't exist, it will be created, along with all necessary parent directories. The task uses PowerShell's New-Item
cmdlet to create the file. By default, an empty file is created. To give the file specific content, pass that content to the Content
property.
If you pass paths of files that exist, the task won't do anything to those existing files. If you pass the Touch
property, it will update each file's last write time to the current date/time. If you pass the Content
property, each file's content will be reset to that value.
The File
task was added in Whiskey 0.42.0.
-
Path
(mandatory): a list of paths to create, update, or touch. Wildcards supported when updating or touching files. -
Content
: the content of the file. -
Touch
: iftrue
, sets the file's last modification date to the current date/time. The default isfalse
.
Build:
- File
Path: non-existing_directory/file.txt
Content: 'File content.'
In this example, the path to file "file.txt" is created with the content "File content.".
Build:
- File:
Path: file.txt
In this example, an empty file is created.
Build:
- File:
Path: file.txt
Touch: true
This example demonstrates how to update the last modified timestamp of a file to the current date/time.
- Common Task Properties
- AppVeyorWaitForBuildJob
- CopyFile
- Delete
- DotNet
- Exec
- File
- GetPowerShellModule
- GitHubRelease
- InstallNodeJs
- LoadTask
- Log
- MergeFile
- MSBuild
- NuGetPack
- NuGetPush
- NuGetRestore
- NUnit2
- NUnit3
- Parallel
- Pester
- Pipeline
- PowerShell
- ProGetUniversalPackage
- PublishBitbucketServerTag
- PublishBuildMasterPackage
- PublishNodeModule
- PublishPowerShellModule
- PublishProGetAsset
- PublishProGetUniversalPackage
- SetVariable
- SetVariableFromPowerShellDataFile
- SetVariableFromXml
- TaskDefaults
- Version
- Zip