Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have an assignment where I have to write a powershell command on windows server 2019 that copies my documents folder to another folder called backups. my current script looks like this:

copy-item C:\Users\Administrator\Documents\ -destination C:Users\Administrator\Backups(get-date format "dd_mm_yyyy--hh_mm_ss")

however, when I run the script it creates a folder in my backups folder but it doesn't have anything in it. what should I fix so it has all the files in my documents folder in this backups folder?

4

1 Answer

Tested. This code works. Taken from

[string]$sourceDirectory = "C:\Temp\Random_Folder"
[string]$destinationDirectory = "C:\Users\anyuser\Documents"
Copy-item -Force -Recurse -Verbose $sourceDirectory -Destination $destinationDirectory

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy