{"id":16567141,"url":"https://github.com/joeltimothyoh/copy-files","last_synced_at":"2026-06-04T12:31:14.847Z","repository":{"id":183740287,"uuid":"112789355","full_name":"joeltimothyoh/Copy-Files","owner":"joeltimothyoh","description":"Copies specified files and directories to each specified destination using Robocopy.","archived":false,"fork":false,"pushed_at":"2021-07-14T07:16:15.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T23:43:02.606Z","etag":null,"topics":["batch-copy","copy","copy-data","copy-files","powershell-script","robocopy","sync","sync-data","sync-files","transfer-data","transfer-files"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joeltimothyoh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-01T21:37:24.000Z","updated_at":"2022-05-13T14:53:24.000Z","dependencies_parsed_at":"2023-07-25T16:37:31.228Z","dependency_job_id":null,"html_url":"https://github.com/joeltimothyoh/Copy-Files","commit_stats":null,"previous_names":["joeltimothyoh/copy-files"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeltimothyoh%2FCopy-Files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeltimothyoh%2FCopy-Files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeltimothyoh%2FCopy-Files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeltimothyoh%2FCopy-Files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeltimothyoh","download_url":"https://codeload.github.com/joeltimothyoh/Copy-Files/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242008821,"owners_count":20056970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch-copy","copy","copy-data","copy-files","powershell-script","robocopy","sync","sync-data","sync-files","transfer-data","transfer-files"],"created_at":"2024-10-11T21:05:45.152Z","updated_at":"2026-06-04T12:31:14.828Z","avatar_url":"https://github.com/joeltimothyoh.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Copy-Files\n\nCopies specified files and directories to each specified destination using Robocopy.\n\n## Description\n\n* Specified sources, destinations, and robocopy options will be used to make copy operations.\n* Both files and directories can be used as sources.\n* Sources and destinations paths can either be local (e.g. `'C:\\Folder'`), network (e.g. `'\\\\ServerName\\Folder'`), or relative from the working directory (e.g. `'Folder\\Subfolder'`).\n\n## Usage\n\nCopy-Files can either be used as a standalone script, or as a module together with separate configuration scripts. The Standalone script allows for greater portability and isolation, while the module allows for greater accessibility, scalability and upgradability.\n\n### Standalone Script\n\n* Specify the sources, destinations, and robocopy options within the `Copy-Files.ps1` script.\n* Give the script a unique name.\n* Run the script to copy the files and directories.\n\n### Module with config scripts\n\n* Install the `Copy-Files.psm1` module. Refer to Microsoft's documentation on installing PowerShell modules.\n* Specify the sources, destinations, and robocopy options within the `Copy-Files-Config.ps1` script.\n* Give the configuration script a unique name.\n* Run the script to copy the files and directories.\n\n## Batches\n\nMultiple standalone or configuration scripts can be used to organize copying, with each script representing a batch of files and directories.\n\n* Make as many copies of the standalone or configuration script as required.\n* Give each script a unique name.\n* Specify the sources, destinations, and robocopy options within each script.\n* Run each script to copy their respective files and directories.\n\nExample use of several scripts, each representing a separate batch of files and directories:\n\n```powershell\nCopy-Files-Project1.ps1\nCopy-Files-Project2.ps1\nCopy-Files-Data1.ps1\nCopy-Files-Data2.ps1\nCopy-Files-Update.ps1\nCopy-Files-Backup.ps1\n```\n\n## Copying\n\n### via File Explorer\n\n* Right-click the script, and choose 'Run with PowerShell'.\n\n### via Command line\n\n* Run the script via a command line.\n\n```powershell\nPowershell \"C:\\path\\to\\script.ps1\"\n```\n\n### Scheduling\n\nCopy-Files scripts can be scheduled to automatically make copies of files and directories.\n\n* Set up the script to be run.\n* In *Task Scheduler*, create a task with the following *Action*:\n  * *Action*: `Start a program`\n  * *Program/script*: `Powershell`\n  * *Add arguments (optional)*: `\"C:\\path\\to\\script.ps1\"`\n* Repeat the steps for each script that is to be scheduled.\n\nRefer to Microsoft's documentation or guides for further help on using *Task Scheduler*.\n\n## Parameters\n\n```powershell\nCopy-Files [-Sources] \u003cString[]\u003e [-Destinations] \u003cString[]\u003e [[-RobocopyOptions] \u003cString[]\u003e] [\u003cCommonParameters\u003e]\n\nPARAMETERS\n    -Sources \u003cString[]\u003e\n\n    -Destinations \u003cString[]\u003e\n\n    -RobocopyOptions \u003cString[]\u003e\n\n    \u003cCommonParameters\u003e\n        This cmdlet supports the common parameters: Verbose, Debug,\n        ErrorAction, ErrorVariable, WarningAction, WarningVariable,\n        OutBuffer, PipelineVariable, and OutVariable. For more information, see\n        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).\n```\n\n### Examples\n\n#### Example 1\n\nRuns the script `Copy-Files-Project1.ps1` within the working directory in the current instance of Powershell.\n\n```powershell\n.\\Copy-Files-Project1.ps1\n```\n\n#### Example 2\n\nRuns the `Copy-Files` module to copy file `C:\\Files\\File.txt` and directory `C:\\Folder` into directory `D:\\BackupFolder` with robocopy options `/E` and `/PURGE`.\n\n```powershell\nCopy-Files -Sources 'C:\\Files\\File.txt','C:\\Folder' -Destinations 'D:\\BackupFolder' -RobocopyOptions '/E','/PURGE'\n\n```\n\n## Security\n\nUnverified scripts are restricted from running on Windows by default. In order to use `Copy-Files`, you will need to allow the execution of unverified scripts. To do so, open PowerShell as an *Administrator*. Then run the command:\n\n```powershell\nSet-ExecutionPolicy Unrestricted -Force\n```\n\nIf you wish to revert the policy, run the command:\n\n```powershell\nSet-ExecutionPolicy Undefined -Force\n```\n\n## Notes\n\n* Copy-Files serves as a wrapper around Robocopy as a convenient and automatable file and directory copying solution.\n* Robocopy, otherwise known as Robust File Copy, is a command-line directory and/or file replication command in Windows.\n* It is recommended you have some knowledge about and experience with Robocopy before using Copy-Files.\n* For more information on Robocopy, refer to Microsoft's documentation on the command, or run `'robocopy /?'`.\n\n### Tips\n\n* To quickly get the full path of a file or directory in File Explorer, simply *Shift + Right-Click* on the item and select 'Copy as path'.\n* To quickly open a PowerShell instance from File Explorer, simply *Shift + Right-Click* on a directory or anywhere within it and select 'Open PowerShell window here'.\n\n## Requirements\n\n* Windows with \u003ca href=\"https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell?view=powershell-5.1\" target=\"_blank\" title=\"PowerShell\"\u003ePowerShell v3 or higher\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeltimothyoh%2Fcopy-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeltimothyoh%2Fcopy-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeltimothyoh%2Fcopy-files/lists"}