Forum Discussion

afierro97's avatar
afierro97
Copper Contributor
Oct 18, 2023
Solved

Problems moving files from site to site | PnP Sharepoint

Hello! I have a file with all the paths to different files in different sites of my tenant that I need to move to a Specific Site in the same tenant, so I decided to use the PnP cmdlets for the job....
  • afierro97's avatar
    afierro97
    Nov 01, 2023

    In case someone has the same problem as me, this is how i solved the problem.

    When connecting I connect to the source site

    Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/Source Site"

    then, when you use the move command use it like this:

    $SourceFileURL= "/sites/mySite/folder/file.txt" #Site Relative URL from the current site
    $TargetFileURL ="/sites/anotherSite/folder"
    Move-PnPFile -SourceUrl $SourceFileURL -TargetUrl $TargetFileURL

    if u use /sites/<the name of the site> you will be able to move the files the any site you want

     

     

Resources