title: Upload multiple files from multiple folders to SharePoint online using Powershell
body: <p>Fairly new to both SharePoint online and Powershell and thought this would be a pretty simple task, but I'm reaching out for help.</p>
  
  <p>I have a client who has photos stored in multiple folders in a file share and they want to move this to SharePoint. They want to use the folder name of where the file exits as metadata to make searching easier. </p>
  
  <p>This is the script I am using and not having much luck. </p>
  
  <pre><code>$connection = Connect-PnPOnline https://somecompany.sharepoint.com -Credentials $me -ReturnConnection 
  
  $files = Get-ChildItem "F:\some data" -Recurse
  
  foreach ($file in $files)
    {Add-PnPFile -Path $file.FullName -Folder Photos -Values @{"Title" = $file.Name;} -Connection $connection}
  </code></pre>
  
  <p>Issue I am having, is that this does not recurse the folders and comes back with " Local file not found"</p>
  
  <p>If I can get that working, I can move onto getting the current folder name as a variable into metadata.</p>
  
  <p>I'm pretty sure that this will be a simple task for experts, but alas that I am not.Any help will be greatly appreciated.</p>
  
  <p>Thanks
  Jassen</p>