{"id":9685,"date":"2023-07-05T05:38:00","date_gmt":"2023-07-05T03:38:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=9685"},"modified":"2023-09-12T12:29:13","modified_gmt":"2023-09-12T10:29:13","slug":"copy-files-recursively-in-powershell","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/","title":{"rendered":"How to copy files recursively in PowerShell using Copy-Item?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"h-this-microsoft-tutorial-explains-how-to-copy-files-and-folders-recursively-in-powershell-using-the-windows-copy-item-command\"><strong><em>This Microsoft tutorial explains how to copy files and folders recursively in PowerShell, using the Windows Copy-Item command.<\/em><\/strong><\/h4>\n\n\n\n<p>The Copy-Item command allows you to copy Windows files recursively in PowerShell, using a single command. The user can run scripts on Windows servers or clients, which are similar to the batch files of older versions of Windows, i.e. MS-DOS commands. Note that both <a href=\"https:\/\/expert-only.com\/en\/ms-dos\/\">DOS commands<\/a> and PowerShell are available on Windows 10 and Windows 11 for example as well as in previous Windows versions.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#1-powershell-scripts-and-the-copy-item-command\" >1. PowerShell scripts and the Copy-Item command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#2-list-recursively-files-folders-and-subfolders-before-the-copy\" >2. List recursively files, folders, and subfolders before the copy<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#3-copy-files-recursively-from-source-folder-to-target-with-absolute-paths\" >3. Copy files recursively from source folder to target with absolute paths<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#4-check-the-target-folder-after-the-copy\" >4. Check the target folder after the copy<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#5-copy-files-recursively-and-force-overwrite-of-the-target\" >5. Copy files recursively and force overwrite of the target<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#6-selecting-specific-file-type-extensions-to-copy\" >6. Selecting specific file type extensions to copy<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#7-exclude-files-from-the-powershell-copy\" >7. Exclude files from the PowerShell copy<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-powershell-scripts-and-the-copy-item-command\"><span class=\"ez-toc-section\" id=\"1-powershell-scripts-and-the-copy-item-command\"><\/span>1. PowerShell scripts and the Copy-Item command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First of all, <strong>Windows PowerShell is a task-based command-line shell and scripting language that is built on the .NET Framework<\/strong>. Windows PowerShell includes a cmdlet (command-line tool) for copying files. Cmdlets are like small commands that can be combined to perform tasks such as copying files. <\/p>\n\n\n\n<p>The script language will help you <strong>reduce the time it takes to copy files, automate tasks, manage system configurations<\/strong>, and more. The Copy-Item cmdlet can be used to copy one or more items from one location to another, such as from a file system folder to a CD drive, or from one folder in a file system tree to another folder in the same tree.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2-list-recursively-files-folders-and-subfolders-before-the-copy\"><\/span>2. List recursively files, folders, and subfolders before the copy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The script starts by defining the location of the source folder and then copies all <a href=\"https:\/\/www.dictionary.com\/browse\/file\" target=\"_blank\" rel=\"noreferrer noopener\">files<\/a> and folders from that location to the destination folder. For example, here is a simple, practical case, a <strong>C:\\WORK\\Folder<\/strong> source folder with two subfolders:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><em>Folder<\/em><\/strong> contains<ul><li>file (1).txt<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li>file (2).txt<\/li>\n\n\n\n<li>file (3).txt<\/li>\n\n\n\n<li>The <strong><em>SubFolder_1<\/em><\/strong> folder contains\n<ul class=\"wp-block-list\">\n<li>file (4).txt<\/li>\n\n\n\n<li>file (5).txt<\/li>\n\n\n\n<li>file (6).txt<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>The goal is to copy all the files and the tree structure into the target folder: <strong>C:\\WORK\\Target<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Get-ChildItem C:\\WORK\\Folder -Recurse<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"669\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-source-folder-files-recursively.jpg\" alt=\"List all files recursively with the PowerShell Get-ChildItem command\" class=\"wp-image-9647\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-source-folder-files-recursively.jpg 768w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-source-folder-files-recursively-300x261.jpg 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><figcaption class=\"wp-element-caption\">List all files recursively with the PowerShell Get-ChildItem command<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-copy-files-recursively-from-source-folder-to-target-with-absolute-paths\"><\/span>3. Copy files recursively from source folder to target with absolute paths<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this third section, we present this time a script to copy all files in folders and subfolders with the Copy-Item command and the <strong><em>-Recurse<\/em><\/strong> option.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Copy-Item -Path C:\\WORK\\Folder\\ -Destination C:\\WORK\\Target -Recurse<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"797\" height=\"186\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively.jpg\" alt=\"Copy files recursively in PowerShell with Copy-Item\" class=\"wp-image-9654\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively.jpg 797w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-300x70.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-768x179.jpg 768w\" sizes=\"auto, (max-width: 797px) 100vw, 797px\" \/><figcaption class=\"wp-element-caption\">Copy files recursively in PowerShell with Copy-Item<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-check-the-target-folder-after-the-copy\"><\/span>4. Check the target folder after the copy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It is also possible to check that the files are copied to the target folder:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Get-ChildItem C:\\WORK\\Target -Recurse<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"720\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-target-folder-files-recursively.jpg\" alt=\"Display files and folders in the target folder recursively in PowerShell\" class=\"wp-image-9660\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-target-folder-files-recursively.jpg 720w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-target-folder-files-recursively-300x300.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-display-target-folder-files-recursively-150x150.jpg 150w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption class=\"wp-element-caption\">Display files and folders in the target folder recursively in PowerShell<\/figcaption><\/figure><\/div>\n\n\n<p>The script has successfully copied all files and folders from the WORK folder, <strong>including the folder named Folder<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5-copy-files-recursively-and-force-overwrite-of-the-target\"><\/span>5. Copy files recursively and force overwrite of the target<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To force the copy if one or more folders or files already exist in the target folder, use the -Force option.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Copy-Item -Path C:\\WORK\\Folder\\ -Destination C:\\WORK\\Target -Recurse -Force<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"798\" height=\"186\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-force-option.jpg\" alt=\"Copy files recursively in PowerShell with Copy-Item and overwrite the target\" class=\"wp-image-9670\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-force-option.jpg 798w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-force-option-300x70.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/08\/powershell-copy-item-files-recursively-force-option-768x179.jpg 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><figcaption class=\"wp-element-caption\">Copy files recursively in PowerShell with Copy-Item and overwrite the target<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6-selecting-specific-file-type-extensions-to-copy\"><\/span>6. Selecting specific file type extensions to copy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The script also provides an option to copy only specific file types, such as *.docx or *.jpg, or a specific file with a given name. For example, to force the copy of TXT files only and ignore all other extensions, use this script:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Copy-Item -Path C:\\WORK\\Folder\\ -Destination C:\\WORK\\Target -Recurse -Force -Filter \"*.txt\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7-exclude-files-from-the-powershell-copy\"><\/span>7. Exclude files from the PowerShell copy <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Finally, the script offers an option to exclude certain directories from the copy. To exclude file extensions, use the PS -Exclude option. In this example, the copy is recursive and copies all files except Word files with a Docx extension.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Copy-Item -Path C:\\WORK\\Folder\\ -Destination C:\\WORK\\Target -Recurse -Exclude \"*.docx\"<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-recursive-file-copy-using-powershell\">Conclusion on recursive file copy using PowerShell<\/h3>\n\n\n\n<p>To conclude, this article details how to use PowerShell&#8217;s Copy-Item command for file management. It teaches readers to list files recursively using the Get-ChildItem command, copy files with the -Recurse option, verify copied content in the target location, and overwrite existing files with the -Force option. Still with Windows commands, it is also possible to perform the same <a href=\"https:\/\/expert-only.com\/en\/ms-dos\/copy-recursively-files-and-folders-in-cmd-with-xcopy\/\">recursive copy of files and folders with the DOS xcopy command<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"gHgcojFGhX\"><a href=\"https:\/\/expert-only.com\/en\/ms-dos\/copy-files-recursively-with-cmd\/\">How to copy files recursively using Windows cmd?<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to copy files recursively using Windows cmd?&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/ms-dos\/copy-files-recursively-with-cmd\/embed\/#?secret=EDPIvx2F6n#?secret=gHgcojFGhX\" data-secret=\"gHgcojFGhX\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>This Microsoft tutorial explains how to copy files and folders recursively in PowerShell, using the Windows Copy-Item command. The Copy-Item command allows you to copy Windows files recursively in PowerShell, using a single command. The user can run scripts <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\" title=\"How to copy files recursively in PowerShell using Copy-Item?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":6058,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[522],"tags":[],"class_list":{"0":"post-9685","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ps"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to copy files recursively in PowerShell? Windows Scripting<\/title>\n<meta name=\"description\" content=\"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to copy files recursively in PowerShell using Copy-Item?\" \/>\n<meta property=\"og:description\" content=\"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-05T03:38:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-12T10:29:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How to copy files recursively in PowerShell using Copy-Item?\",\"datePublished\":\"2023-07-05T03:38:00+00:00\",\"dateModified\":\"2023-09-12T10:29:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\"},\"wordCount\":620,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg\",\"articleSection\":[\"Powershell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\",\"url\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\",\"name\":\"How to copy files recursively in PowerShell? Windows Scripting\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg\",\"datePublished\":\"2023-07-05T03:38:00+00:00\",\"dateModified\":\"2023-09-12T10:29:13+00:00\",\"description\":\"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to copy files recursively in PowerShell using Copy-Item?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to copy files recursively in PowerShell? Windows Scripting","description":"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/","og_locale":"en_US","og_type":"article","og_title":"How to copy files recursively in PowerShell using Copy-Item?","og_description":"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.","og_url":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-07-05T03:38:00+00:00","article_modified_time":"2023-09-12T10:29:13+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How to copy files recursively in PowerShell using Copy-Item?","datePublished":"2023-07-05T03:38:00+00:00","dateModified":"2023-09-12T10:29:13+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/"},"wordCount":620,"commentCount":2,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg","articleSection":["Powershell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/","url":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/","name":"How to copy files recursively in PowerShell? Windows Scripting","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg","datePublished":"2023-07-05T03:38:00+00:00","dateModified":"2023-09-12T10:29:13+00:00","description":"PS script to copy files and folders recursively in Windows PowerShell, example to force overwrite, filter or exclude file extensions.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/01\/entrepreneur_dark_heavy-antique-typewriter-4DCBC2BD36D_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/ps\/copy-files-recursively-in-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to copy files recursively in PowerShell using Copy-Item?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=9685"}],"version-history":[{"count":3,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9685\/revisions"}],"predecessor-version":[{"id":26942,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9685\/revisions\/26942"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/6058"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=9685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=9685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=9685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}