CopyFile

Last Updated2026-07-26
Created At2026-07-26

Copies a file. If the destination file already exists, it is overwritten.

native bool CopyFile(const char[] newpath, const char[] oldpath, bool use_valve_fs = false, const char[] source_path_id = "GAME", const char[] dest_path_id = "DEFAULT_WRITE_PATH")

Parameters

const char[] newpath
Path to the destination file.
const char[] oldpath
Path to the existing source file.
bool use_valve_fs
If true, the Valve file system will be used instead. This can be used to copy files in the game's Valve search paths, rather than directly in the gamedir.
const char[] source_path_id
If use_valve_fs, the gameinfo search path used to locate the source file, or NULL_STRING for all search paths.
const char[] dest_path_id
If use_valve_fs, the gameinfo search path used to write the destination file, or NULL_STRING for the default write path.

Return Value

bool True on success, false otherwise.