Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The next script will be creating a backup script . In order to do this you will

ID: 3591714 • Letter: T

Question

The next script will be creating a backup script. In order to do this you will need to determine what files you want to backup, and the destination. You may want to backup school files, pictures, important documents, and so on. The files you will backup will need to be in a specific folder (i.e., C:UsersSusieDocumentsFiles). Then you will need a separate place to backup your data. It could be a separate folder on your C: drive, or it could be an external drive or usb drive.

You will also give your backup folder a custom name with the date. However, to do this you will need to strip out the / signs in the date. If you keep the / signs in the date then when you create your backup

So we need to strip out the month, day, and year. We do this by extracting a position and number of characters. So this command: %date:~4,2% will start at the 4th character and extract two characters

with the result of 07. To pull out the month, day, and year, use the following command. %date:~4,2%%date:~7,2%%date:~10,4%

We will use this to create our backup folder name.

Next, we will use the xcopy command to copy all files and subdirectories. The xcopy command works like this: xcopy source destination

So if you want to copy files from your C:usersginaDocumentswork to your E:ackup (E: is the USB drive in this case) you would use this command: xcopy C:usersginaDocumentswork* E:ackup* /S /Y /I

Note the switch S will copy all files and folders including subfolders, Y will overwrite files and not ask for confirmation, I will automatically create subfolders.

Explanation / Answer

@echo off

::To strip date in required format

set date=%date:~4,2%%date:~7,2%%date:~10,4%

::To create backup

xcopy "D:Chegg*" "C:UsersKuruba%date%*" /S /Y /I

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote