File

File Operations

CopyTo copies the file to a destination path. MoveTo moves the file to a new location - the original is removed. Delete() removes the current file. Delete(string) removes the file at a specified path. ToGPALObject() returns the GPALFile instance typed as IGPALFile for interface-based use. These operations work on the file specified by WithFileName (or GPAL.FileFor).

Examples

GPAL Fluent: High-level fluent C# API

//CopyTo and MoveTo accept a full destination path including the filename. If the destination directory does not exist, the operation will fail - ensure the target directory exists before calling.

// Copy a downloaded file to a target directory

GPAL.File

.WithFileName("C:\Downloads\report.pdf")

.CopyTo("C:\Archive\reports\2026-report.pdf");


// Move a processed file

GPAL.File

.WithFileName("C:\Inbox\data.csv")

.MoveTo("C:\Processed\data.csv");


// Delete a temporary file

GPAL.File

.WithFileName("C:\temp\working.tmp")

.Delete();

💬 Ask GPAL