Skip to main content

Copy-File

SYNOPSISโ€‹

Copy a file or group of files to a destination path.

SYNTAXโ€‹

Copy-File [-Path] <String[]> [-Destination] <String> [-Recurse] [-Flatten] [[-ContinueOnError] <Boolean>]
[[-ContinueFileCopyOnError] <Boolean>] [<CommonParameters>]

DESCRIPTIONโ€‹

Copy a file or group of files to a destination path.

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Copy-File -Path "$dirSupportFiles\MyApp.ini" -Destination "$envWinDir\MyApp.ini"

EXAMPLE 2โ€‹

Copy-File -Path "$dirSupportFiles\*.*" -Destination "$envTemp\tempfiles"

Copy all of the files in a folder to a destination folder.

PARAMETERSโ€‹

-Pathโ€‹

Path of the file to copy.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Destinationโ€‹

Destination Path of the file to copy.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Recurseโ€‹

Copy files in subdirectories.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Flattenโ€‹

Flattens the files into the root destination directory.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ContinueOnErrorโ€‹

Continue if an error is encountered. This will continue the deployment script, but will not continue copying files if an error is encountered. Default is: $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

-ContinueFileCopyOnErrorโ€‹

Continue copying files if an error is encountered. This will continue the deployment script and will warn about files that failed to be copied. Default is: $false.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParametersโ€‹

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTSโ€‹

Noneโ€‹

You cannot pipe objects to this function.โ€‹

OUTPUTSโ€‹

Noneโ€‹

This function does not generate any output.โ€‹

NOTESโ€‹

https://psappdeploytoolkit.com