Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to copy files and directories by batch Xcopy

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how batch processing Xcopy realizes copying files and directories. It has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

copy copy file

Xcopy copies files and directories, including subdirectories.

syntax

xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n] [/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

Source is required. Specify the location and name of the file to copy. This parameter must contain a drive or path.

Destination Specifies the destination of the file to copy. This parameter can contain a drive letter and colon, a directory name, a file name, or a combination thereof.

XCOPY has many functions, which are completed by adding parameters.

Parameters:

/A Copies only files with archived attribute sets, but does not change attributes.

/M Copy only files with archive attribute sets and turn off archive attributes.

/D:m-d-y Copies files that changed on or after the specified date. If no date is provided, copy only files whose source time is newer than the target time.

/EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. If any string matches the absolute path of the file to be copied, that file will not be copied.

For example, specifying strings such as\obj\or.obj excludes

All files under directory obj or files with.obj extension.

/P prompts you to confirm that you want to create each destination file.

/S Copy directories and subdirectories, except empty ones.

/E Copy directories and subdirectories, including empty ones. Same as/S /E. It can be used to modify/T.

/V Verify each file as it is written to the destination file to ensure that the destination file is identical to the source file.

/W prompts you to press the key before copying. Press any key to begin copying file(s)

/C Continue copying even with errors. (Ignore errors.)

/I If the destination does not exist and more than one file is being copied, it is assumed that the destination must be a directory.

/Q Does not display xcopy messages when copying.

/F Display full source and destination file names when copying.

/L Displays the file to copy.

/G allows copying unencrypted files to destinations that do not support encryption.

/h Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.

/R Overwrites read-only files.

/T Create directory structure without copying files. Does not include empty directories or subdirectories./ T /E includes empty directories and subdirectories.

/U Copies only files that already exist in the destination.

/k Copies the file, and if the source file has a read-only attribute, retains that attribute in the destination file. By default, xcopy removes read-only attributes.

/N Copy with generated short name.

/O Copies file ownership and ACL information.

/X Copy file audit settings (implied/O).

/Y Disable prompt confirmation to overwrite an existing target file.

/-Y causes a prompt to confirm overwriting an existing target file.

/Z If connectivity is lost during replication (for example, if the server used for the connection goes offline), replication resumes when connectivity is reestablished./ z also shows the percentage of copy operations completed for each file.

Some usage examples and parameter descriptions are as follows:

1. Copy all the PPT folders under drive C to drive D. The above/s /e parameters are used to copy both subdirectories and empty directories, respectively.

C:\>xcopy C:\ppt\*.* D:\ppt\ /s /e

2. Copy all files on disk E:\to disk D:\. If you don't want him to copy files during the copying process! Then press the keyboard hotkey "Ctrl " +"Pause /break" two hotkeys to interrupt copying.

C:\>xcopy e:\*.* d: /s /h

If you want to copy all the files on disk E:\to disk D:\, you can copy them today, copy them tomorrow, and copy them the day after tomorrow. Or for some reason, the last copy was not completed, and today I want to continue copying.

C:\xcopy e:\*.* d: /s /h /d /y He can find out which files have been copied and which files have not been copied.

4. We have modified some documents! The latest version is available online. We need to update the original backup file. So how do we synchronize updates?

If there are a lot of files modified, I can't remember which file is updated. So many original backup files have to be updated and copied in the past, which is not a labor-saving job, and it is easy to make mistakes and forget some files!

C:\xcopy e:\*.* d: /s /h /d /y

4, there is also a situation we often encounter, because copying a file error or this file in use, and stopped copying work,(for example, copy C disk on Windows XP) We want to skip a certain error file and a file in use and continue to copy other files.

C:\xcopy e:\*.* d: /s /h /d /c /y !

5. Sometimes we want XCOPY to be automatically copied, and after copying is completed, turn off the computer, you can create a batch file, create a new text document, rename it XCOPY.BAT Of course, the extension originally in TXT format should be renamed BAT Enter in this XCOPY.BAT

C:\xcopy e:\*.* d: /s /h /c /y

shutdown -s

Then double-click xcopy.bat to run it and you can go out and play. The computer copies the backup file and shuts down automatically.

Thank you for reading this article carefully. I hope that Xiaobian's article "How to copy files and directories in batch processing Xcopy" will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report