Powershell Script

Gabi1986 1 Reputation point
2020-08-03T15:49:06.427+00:00

15137-myscript.jpg

Hello Everyone,

I'm a beginner Powershell user. Could anyone help me to finish this script? I'd like to copy new files from "$a" to "$b"... automatically of course. How should I move on?
Thanks a lot.

Windows for business | Windows Server | User experience | PowerShell

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 132.9K Reputation points MVP Volunteer Moderator
    2020-08-03T18:29:49.417+00:00

    Maybe this is helpful. (For any reason I can't post this as code ... getting an "Access denied" everytime)

    15158-code.png

    Regards

    Andreas Baumgarten

    (Please don't forget to Accept as answer if the reply is helpful)

    Was this answer helpful?

    1 person found this answer helpful.

  2. gastone canali 241 Reputation points Volunteer Moderator
    2020-08-27T00:19:32.103+00:00

    With Powershell you can do everything, but robocopy.exe is insuperable for copying, synking also deleting!
    This is the code, remove /L when you are sure...
    /L : List only - don’t copy, timestamp or delete any files.

    $Afolder = 'c:\user\Gab\desktop\A'  
    $Bfolder =  'c:\user\Gab\desktop\B'  
      
      
      
    Invoke-Command { robocopy.exe $afolder $Bfolder /L /s /w:0 /r:0 }  
    

    robocopy

    robocopy.html

    Was this answer helpful?

    0 comments No comments

  3. Young Yang (Shanghai Wicresoft Co,.Ltd.) 661 Reputation points
    2020-08-20T01:45:38.553+00:00

    Hi, given that this post has been quiet for a while, this is a quick question and answer. Has your question been solved? If so, please mark it as an answer so that users with the same question can find and get help

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.