Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use batch processing to realize data backup of U disk

Shulou Source: shulou.com Published: 2022-06-03 07:50:53 11月15日 Update

This article mainly shows you "how to use batch processing to achieve U disk data backup", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use batch processing to achieve U disk data backup" this article.

Description:

1. Automatically detect all removable disks (if you want to apply to floppy disks, please add two drive letters An and B in the FOR statement)

2. All files in the default backup disk can be modified to back up files of a specified type according to the comments.

4. For more information, please see the notes in the code.

The batch code is as follows:

The code is as follows:

@ echo off

:: set the backup folder path

Set bakpth=D:\ UDISKBAK

:: if the variable type value is empty, all files in the USB drive are backed up by default, if only .RAR type files are backed up, then set type=.RAR, and so on

Set type=

: get the drive letter of the USB drive and perform the backup operation

For an in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

)

Exit

: ucopy

:: copy USB disk files. Empty folders are not copied by default. If you need to copy empty folders, change the following command switch / s to / e

Xcopy / s/h/y% udisk%:\ *% type% "% bakpth%\% udisk%" > nul 2 > nul

Goto: eof

The above is all the contents of the article "how to use batch processing to achieve USB disk data backup". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Backup files folders data data backup code content articles comments types paths learning help move and so on two items variables commands easy to understand Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS vpn OPPO Reno Huawei Shulou Technology