Copy-PnPFile to copy Folder contents (not the top-level folder itself) #2729
Unanswered
TheRealStriff
asked this question in
Q&A
Replies: 1 comment
-
Ran into this issue today as well. $subfolders = Get-PnPFolderInFolder -FolderSiteRelativeUrl $SourceURL
foreach ($folder in $subfolders) {
Copy-PnPFolder -SourceUrl $folder.ServerRelativeUrl -TargetUrl $TargetUrl -Force
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
``Hi,
Part of my script is to copy folders and files underneath a particular folder from one Library to another Library on another SharePoint site.
What I'm using.
`$SourceSiteURL="https://XXXXsharepoint.com/sites/SPO-PLT"
$SourceURL="SREst/Templates/Tender Templates - Trial"
$TargetSiteURL="https://XXXX.sharepoint.com/sites/$Alias"
$TargetURL="/sites/$Alias/SR/03 Estimating"
Connect-PnPOnline -Url $sourceSiteURL -Interactive
Copy-PnPFile -SourceUrl $SourceURL -TargetUrl $TargetURL -OverwriteIfAlreadyExists `
(Note $Alias is identified earlier on the script)
What happens is it copies the folder "Tender Templates - Trial" and its contents into the new site / library ' folder location, but I only want to copy the contents of this folder, not the folder itself.
As the destination has the same folder structure, but not the files... So I want only the contents to be copied across....
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions