PowerShell – Backup File Plan with OneDrive and task scheduler

  1. Setup OneDrive Account, set on your computer for syn purpose
  2. use powershell script (below) to copy target data into onedrive folder


PowerShell script to copy file into other file

#source: https://blog.csdn.net/zhang_ruisen/article/details/51038028

#Source_Path is string that from backup path folder

#Destination_Home is to backup path

#Test if destination if exsit, if no create new one
if(!(Test-Path -Path $Destination_Path))
New-Item -ItemType directory -Path $Destination_Path

#foreach copy, will run backup path folder and copy each file to the destination folder
foreach($Path in $Source_Path)
Copy-Item -Path $Path -Destination $Destination_Path -Recurse -Force

About: Raymond