How to use Xcopy to copy local files to a remote server

Source: Internet
Author: User
Tags file copy naming convention

   a.net Use IP address password/user:******

  b.xcopy file IP address   batch file is backup.bat with the following code:   ====================================================== ===================================   net use 192.168.1.198ipc$ zqf198703/user:royalpeak   xcopy   G:B Ackup*.*      192.168.1.198 data backup/d/e/y/h/k   net use 192.168.1.198ipc$/delete   with xcopy command Can do   xcopy source path target path   Copy files and directories, including subdirectories.   Syntax   xcopy Source [destination] [/w] [/P] [/C] [/v] [////////////[/F] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [////   E] [/t] [/k] [/R] [/h] [{/a|/m}] [/n] [o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]   parameters   Source   required. Specifies the location and name of the file to be copied. The parameter must contain a drive or path.   Destination   Specifies the target of the file to be copied. This parameter can contain a drive letter and a colon, a directory name, a file name, or a combination of them.  /w   Displays the following message and waits for your response before you begin copying files:   Press any key to begin copying file (s)  /P   prompts you to confirm whether To create each destination file.  /C   ignores errors.  /V   validates each file when writing to the destination file to ensure that the target file is identical to the source file. /q   Suppresses xcopy messages from being displayed.  /F   Displays the source and destination file names when copying.  /L   Displays a list of files to copy.  /g   Create the decrypted target file.  /D[:MM-DD-YYYY]   copies only those source files that have been changed after a specified date or a specified date. If you do not include the MM-DD-YYYY value, xcopy copies all new Source files that are newer than the existing destination file. This command-line option allows you to update files that have changed.  /u   only copy files already in destination from source.  /I   if Source is a directory or contains wildcard characters, and destination does not exist, Xcopy assumes destination specifies the directory name and creates a new directory. Xcopy then copies all the specified files to the new directory. By default, Xcopy prompts you to specify whether destination is a file or a directory.  /s   copy non-empty directories and subdirectories. If omitted, the/s,xcopy will work in a directory.  /e   Copy all subdirectories, including empty directories. Use the/e,/s, and/T command-line options at the same time.  /t   copy only the subdirectory structure (that is, the directory tree) and do not copy the files. To copy an empty directory, you must include the/e command-line option.  /k   Copy the file, and if the source file has a read-only property, leave the property in the destination file. By default, Xcopy deletes read-only properties.  /R   Copy read-only files.  /h   Copy files with hidden and system file attributes. By default, Xcopy does not replicate hidden or system files.   A   Copy only the source files that have the archive file property settings. /A does not modify the archive file properties of the source file. For information about how to set archive file properties by using attrib, see Related Topics.  /m   Copy the source file with the Archive file property settings. Unlike/A, the archive file belonging to the file specified in the source is closed by/mOf For information about how to set archive file properties by using attrib, see Related Topics.  /n   Creates a copy using an NTFS short file or directory name. You need/n when you copy a file or directory from an NTFS volume to a FAT volume or when the destination file system requires a FAT file system naming convention (that is, 8.3 characters). The destination file system can be fat or NTFS.  /o   Copy file ownership and discretionary access control List (DACL) information.  /x   Copy file auditing settings and system access control List (SACL) information (including/O).  /exclude:filename1[+[filename2]][+[filename3]]   Specifies a list of files that contain strings.  /y   Suppresses prompting you to confirm that you want to overwrite an existing destination file.  /-y   prompts you to confirm that you want to overwrite the existing destination file.  /z   Replicated over the network in restartable mode.  /?   Display Help at the command prompt.   Note   Use/V   Windows XP does not use this command. Use it only to be compatible with MS-DOS files. Use/exclude   to list each string in a separate row for each file. If any of the strings listed match any part of the absolute path of the file to be copied, the file is excluded from the replication process. For example, if you specify the string "obj", all files under the OBJ directory are excluded. If the string ". obj" is specified, all files with the. obj extension are excluded.   using/z   If a connection is lost during replication (for example, if the server used for the connection is offline), the replication process is restored after the connection is reconnected. /z also displays the percentage of replication operations completed per file.   use/y   in COPYCMD environment variables to use/y in copycmd environment variables. Use/-y on the command line to override the command. By default, you are prompted to overwrite unless you run copy from within a batch script.   Copying encrypted files   Copying encrypted files to volumes that do not support EFS can cause errors. You should first decrypt the file orFiles are copied to the EFS-enabled volume.   attached files   to attach files, specify a single destination file, multiple source files (using wildcard characters or file 1 + file 2 + file 3 format).   Destination Default   If you omit the destination,xcopy command, copy the file to the current directory.   Specify whether destination is a file or directory   if destination does not contain an existing directory and does not end with a backslash (), the following message appears:   Does destination specify a f Ile name   or directory name on the target   (F = file, D = directory)?   If you want to copy one or more files to a file, press F. If you want to copy one or more files to a directory, press D.   Use the/I command-line option to suppress the display of this message, which causes Xcopy to determine that the target is a Directory.   Use the Xcopy command to set the archive properties   xcopy command of the destination file to create a file with an archive property setting, regardless of whether this property is set in the source file. For more information about file properties and attrib, see Related Topics.   Compare xcopy and diskcopy   if the subdirectory of the disk contains files, to copy them to a different format disk, use the Xcopy command instead of the diskcopy. Because the diskcopy command is a track and a track Copy the disk, so you need the same format for the source and destination disks. The xcopy command does not have this requirement. You typically use xcopy unless you need a full copy of the disk image.   xcopy exit code   to process the exit code returned by Xcopy, use the errorlevel parameter on the IF command line of the batch program. For an example of a batch program that uses "if" to handle exit codes, see Related Topics. The following table lists each exit code and description.   Exit code description   0 File copy no error.   1 No files were found to copy. &nBsp 2 users terminated xcopy by pressing CTRL + C.   4 There was an initialization error. There is not enough memory or disk space, or an invalid drive name or syntax was entered on the command line.   5 There was a disk write error   above is the way Xcopy replicates local files to a remote server  

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.