# CopyFileOrDirectory(string, string)

> Copies a file or a directory.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static void CopyFileOrDirectory(string source, string dest)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): **** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Remarks

This function's path can be relative to the project root folder or be an absolute path.

All file separators should be forward ones "/".

Make sure to include the name of the files or directories at the end of the `dest` argument.

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class CopyFile : MonoBehaviour
{
    [MenuItem("Example/Copy Something")]
    static void CopySomething()
    {
        FileUtil.CopyFileOrDirectory("sourcepath/YourFileOrFolder", "destpath/YourFileOrFolder");
    }
}
```
