Use WinRAR to package the files in the list and keep the file structure!

Source: Internet
Author: User
Tags time in milliseconds

Today, I was in a daze And suddenly saw Xiao Chu panic in the group, saying that xcopy could not create the directory structure, so I checked the parameters for him and told him that it was not enough to add the parameters, it doesn't matter if I say this. I got down to it by Chu. I threw the batch processing to him and asked me to help him deal with it. As soon as I saw this batch of processing, there was only one xcopy command with N or more records, I just thought that xcopy is used to copy directories, which has the advantage of using only copy to copy files. But I asked him if he didn't understand the intention of doing so, when I asked, I realized that the game was damaged by a lot of files and it wanted to be replaced. So I used batch processing to Extract files, so I thought about writing the following script. Reference internal volume fix.txt file style:
E: \ online games \ popular games \ datas \ ncsdata \ 3101 \ munpa_boss_light.d2s
E: \ online games \ popular games \ datas \ ncsdata \ 3101 \ munpa_boss_line.d2s
E: \ online games \ popular games \ datas \ ncsdata \ 3101 \ ob_bossrpillar.d2s
E: \ online games \ popular games \ datas \ ncsdata \ 3101 \ pltype_0.d2s

Copy the content to the clipboard program code for/F "tokens = 1, 2 delims =:" % I in (fix.txt) Do (echo f | xcopy/e/h/Y % I: % j d: % J)

After testing, files can be extracted and stored in the original directory structure. However, I suddenly thought that WinRAR should be used for packaging, so why not pack them directly in the script? So I checked WinRAR parameters and wrote a new script to complete automatic packaging.
Let WinRAR automatically package the batch processing script to copy the content to the clipboard program code @ echo off REM code by simple man www.7sec.cn
Set _ RAR = "C: \ Program Files \ WinRAR \ rar.exe"
For/F "tokens = * delims =" % I in (list.txt) Do (% _ RAR % A-inul D: \ bakup.rar % I)

Because he listed a file list for me, I started to compress the files into a package. But as for the next thought, rar should support list files. You can pack all the files in a list into a package, so it is a bit superfluous for me to do this, then I checked the parameters and corrected the script to directly package the entire list into a RAR using a command below. Copy the content to the clipboard program code "C: \ Program Files \ WinRAR \ rar.exe" a-inul test.rar @list.txt

Well, I only write the script above, and I have not introduced the functions of each parameter in this WinRAR. Because there are too many parameters, I just want to explain what I have used, I will attach the original help for others. If you are interested in the study, I will take a look at it. If you have any questions, you can ask me at any time. There are only three pieces of data I can use:
A. Add the file to the RAR package.
Inul prohibits the display of all information. If this switch is not added, information and progress will be displayed for each compression, which will inevitably affect the efficiency.
@ List file: "@" indicates the list file switch. If this switch is enabled, you must add a list file (text file)
The following describes how to use the original WinRAR help reference content: RAR <command>-<switch 1>-<switch n> <compressed file> <file...>
<@ List file...> <decompress path \>

<Command>
A. Add the file to the compressed file.
C. Add a compressed file comment.
Cf add file comment
Ch changes the compressed file Parameters
CW writes compressed file comments to file
D. delete the files in the compressed file.
E. decompress the compressed file to the current directory.
F. Refresh the files in the compressed file.
I [parameter] = <string> Search for strings in the compressed file
K. Lock the compressed file
L [T, B] list compressed files [technical information, concise]
M [f] Move to a compressed file [only for files]
P print the file to the standard output device
R fix compressed files
RC rebuild the lost volume
Rn rename the compressed file
Rr [N] add data recovery records
RV [N] Create recovery volume
S [name |-] convert the compressed file to the self-decompressed format or convert it back to the compressed file
T test compressed files
U updates files in the compressed file
V [T, B] detailed list of compressed files [technical information, concise]
X decompress the file using the absolute path

<Switch>
-Stop Scanning
After the AC is compressed or unzipped, the archive attributes are cleared.
AD: Add compressed file names to the target path
Ag [format] uses the current date to generate compressed file names
AO adds files with compression attributes
AP <format> Add path to compressed file
As: synchronously compress File Content
Add User identity verification for AV (only available in the registered version)
AV-Disable User identity verification
C-Disable annotation display
CFG-Disable read Configuration
CL name to lowercase
Convert Cu name to uppercase
Delete files after DF Compression
DH open shared files
DS disables name sorting for solid compressed files
E [+] <attribute> sets file exclusion and includes attributes
Ed does not add an empty directory
En does not add the "compressed file end" flag
EP exclusion path from name
Exclude the basic directory from the name of EP1
Expand EP2 to complete path
The EP3 extension path is the full path containing the drive letter.
F. Refresh the file
FCU [file] reads compressed file comments from Unicode files
HP [Password] encrypts both file data and file headers
Id [c, d, p, q] disable messages
Ieml [attribute] use e-mail to send compressed files
Ierr sends all messages to standard error Devices
Ilog [name] writes errors to log files (only available in the registered version)
Inul disables all messages
After ioff completes an operation, turn off the PC power supply.
Enable isnd sound
K. Lock the compressed file
KB retains damaged decompressed files
M <0 .. 5> sets the compression level (0-storage... 3-default... 5-maximum)
MC <parameter> set advanced Compression Parameters
MD <size> dictionary size in KB (64,128,256,512,102, 4096, or A-G)
MS [ext; Ext] specifies the file type to store
Mt <thread> sets the number of threads
N <File> only contains the specified file
N @ read the file name from the standard input device to include
N @ <list> include files in the specified file list
O + overwrite existing files
O-Do Not Overwrite existing files
Set NTFS compression attribute for OC
Or automatically rename the file
OS saves NTFS streams
Ow save or restore the file owner and group
P [Password] Set Password
P-No Password inquiry
R recursive subdirectory
R0 only subdirectories with recursive wildcard names
RI <p> [: <S>] sets the priority (0-default, 1-minimum... 15-maximum) and sleep time in milliseconds.
Rr [N] add data recovery records
RV [N] Create recovery volume
S [<n>, V [-], E] create a solid compression File
S-Disable solid-state compressed files
SFX [name]: Create a self-extracting compressed file
St [name] Reading data from standard input device (stdin)
SL <size> process files smaller than the specified size
SM <size> processes files larger than the specified size
T compressed Test File
File Modified after ta <date> Add date <date>, in the format of yyyymmddhhmmss
File Modified before TB <date> Add date <date>, in the format of yyyymmddhhmmss
TK retention time of the original compressed file
TL sets the compressed file time to the latest file time
Files after tn <time> Add <time>
To <time> add files earlier than <time>
TS <m, C, A> [N] file retention or recovery time (modify, create, access)
U Update file
V automatically checks the size of the created volume or lists all the volumes.
V <size> [K, B] Create volume size = <size> * 1000 [* 1024, * 1]
Clear disk content before VD creates capacity
Ver [N] file version control
Vn uses the old-style volume naming scheme
VP is paused before each volume
W <path> specify the working directory
X <File> exclude specified files
X @ read the file name to be excluded from the standard input device
X @ <list> exclude objects in a specified list file
Y. If yes
Z [file] reading compressed file comments from a file

I believe you will have a new understanding of WinRAR through this article, so as to achieve full automation of daily backup and restoration!
This article's feasibility evaluation score: 9 points/total score of 10 points.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.