locked
to get the code for taking the backup entire files and sub folders from one folder to another folder with same structure, Please help RRS feed

  • Question

  • Hi

    I have a  source folder   

    c:\myapp\text1.txt

    c:\myapp\text2.txt

    c:\myapp\text3.txt

    c:\myapp\training\>training.doc 

    Also I have the  another folder e:\BackupApp\> 

    I want to copy all the files from source folder to target folder only if there  is any changes  from the source folder and if there is new files in the source folder. I short, I want to copy to target folder  only  new files and changed files from the source folder. But if we are overwritting any existing file in target folder , the previous files  should be moved to another folder 'Archive23022020' in e:\Backup.  to keep history  of the changed content of the files. So when we move the old file should be named as  <filename>_1, <filename_2> on the current date Archive folder. If there is no Archive+Currentdate folder , should be created  automatically before taking the backup. Please can you give the code  in powershell to take the backup


    polachan

    Sunday, February 23, 2020 10:26 PM

All replies

  • ...Please can you give the code in powershell to take the backup

    No. We do not deliver ready to use code on request. Either you use a backup software - there are even free ones - or you will have to code something by yourself.

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Sunday, February 23, 2020 10:33 PM
  • Use RoboCopy

    Type the following and follow the instructions:

    robocopy /?


    \_(ツ)_/

    Sunday, February 23, 2020 10:41 PM
  • Also be advised that we don't do homework on this forum. If you need help with your homework then ask your instructor or a classmate for help.

    This is to prevent conflicts with your instructors approach to teaching beginning PS.


    \_(ツ)_/

    Sunday, February 23, 2020 10:43 PM
  • If you dont know how to reply please  do not try to answer or you can keep scilence. It is not the job suit for your 

    polachan

    Monday, February 24, 2020 6:46 AM
  • If you dont know how to reply please  do not try to answer or you can keep scilence. It is not the job suit for your 

    If you don't know how to ask a proper question in a technical forum do not try to ask.  ;-)

    We do not provide customized code or scripts on request here. If you have a question to some code YOU WROTE you can post this code here and we will try to help you.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Monday, February 24, 2020 7:12 AM
  • I have no experience in PowerShell programing . Just I am looking for some sample code here. It would be very appreciate if any good expertise  can provide some sample code for the backup. I assume I asked the question the proper way. 

    Many Thanks


    polachan

    Monday, February 24, 2020 10:13 AM
  • So you may start with learning the very basics of Powershell first. There are several good books. Some of them are even free. There are some online tutorials or video courses ... for example: Getting Started with PowerShell 3.0. That's free as well. It just takes you a little time.

    Good luck.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Monday, February 24, 2020 10:40 AM