Windows Copying Files

Posted on by
-->

Combining files. To combine files, specify a single file for the destination, but multiple files as the source. To specify more than one file use wildcards or list the files with a + in between each (file1+file2+file3) When copying multiple files in this way the first file must exist or else the copy will fail. In this article, I’ll show you how to copy, move, delete and rename files using PowerShell. Copying files using PowerShell Start by opening Windows PowerShell in Windows 8.1. Windows has two command line utilities to copy files/directories from command line. Copy command can be used to copy files from one folder to another folder. It can’t be used to copy a complete folder to another location on the disk. Xcopy allows us to do this. Let’s see how we can copy a directory. The copy command allows users to copy one or more files to an alternate location. /V Verifies that new files are written correctly. /N Uses short file name, if available, when copying a file with a non-8dot3 name. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. Copy File from Windows To Linux. If you are using private keys for authentications, you can use -i flag instead of -pw followed by the path to the.ppk file. If your key file is in pem format, you can use the puttygen command to convert it to ppk. For key based authentication, the command looks like below. Windows File Explorer doesn’t allow copying of folders without the files within them. So, if you had to use the same folder structure multiple times for something, you’d have to either copy-paste the folders then delete all files manually or keep a template folder structure at hand to use when needed.

Copies one or more files from one location to another.

For examples of how to use this command, see Examples.

Syntax

Parameters

ParameterDescription
/dAllows the encrypted files being copied to be saved as decrypted files at the destination.
/vVerifies that new files are written correctly.
/nUses a short file name, if available, when copying a file with a name longer than eight characters, or with a file name extension longer than three characters.
/ySuppresses prompting to confirm that you want to overwrite an existing destination file.
/-yPrompts you to confirm that you want to overwrite an existing destination file.
/zCopies networked files in restartable mode.
/aIndicates an ASCII text file.
/bIndicates a binary file.
<Source>Required. Specifies the location from which you want to copy a file or set of files. Source can consist of a drive letter and colon, a directory name, a file name, or a combination of these.
<Destination>Required. Specifies the location to which you want to copy a file or set of files. Destination can consist of a drive letter and colon, a directory name, a file name, or a combination of these.
/?Displays help at the command prompt.

Remarks

  • You can copy an ASCII text file that uses an end-of-file character (CTRL+Z) to indicate the end of the file.

  • Using /a

    When /a precedes or follows a list of files on the command line, it applies to all files listed until copy encounters /b. In this case, /b applies to the file preceding /b.

    The effect of /a depends on its position in the command-line string. When /a follows Source, copy treats the file as an ASCII file and copies data that precedes the first end-of-file character (CTRL+Z).

    When /a follows Destination, copy adds an end-of-file character (CTRL+Z) as the last character of the file.

  • Using /b

    /b directs the command interpreter to read the number of bytes specified by the file size in the directory. /b is the default value for copy, unless copy combines files.

    When /b precedes or follows a list of files on the command line, it applies to all listed files until copy encounters /a. In this case, /a applies to the file preceding /a.

    The effect of /b depends on its position in the command–line string. When /b follows Source, copy copies the entire file, including any end-of-file character (CTRL+Z).

    When /b follows Destination, copy does not add an end-of-file character (CTRL+Z).

  • Using /v

    If a write operation cannot be verified an error message appears. Although recording errors rarely occur with copy, you can use /v to verify that critical data has been correctly recorded. The /v command-line option also slows down the copy command, because each sector recorded on the disk must be checked.

  • Using /y and /-y

    If /y is preset in the COPYCMD environment variable, you can override this setting by using /-y at the command line. By default, you are prompted when you replace this setting, unless the copy command is executed in a batch script.

  • Appending files

    To append files, specify a single file for Destination, but multiple files for Source (use wildcard characters or File1+File2+File3 format).

  • Using /z

    If the connection is lost during the copy phase (for example, if the server going offline breaks the connection), copy /z resumes after the connection is re-established. /z also displays the percentage of the copy operation that is completed for each file.

  • Copying to and from devices

    You can substitute a device name for one or more occurrences of Source or Destination.

  • Using or omitting /b when copying to a device

    When Destination is a device (for example, Com1 or Lpt1), /b copies data to the device in binary mode. In binary mode, copy /b copies all characters (including special characters such as CTRL+C, CTRL+S, CTRL+Z, and ENTER) to the device as data. However, if you omit /b, data is copied to the device in ASCII mode. In ASCII mode, special characters might cause files to combine during the copying process.

  • Using the default destination file

    If you do not specify a destination file, a copy is created with the same name, modified date, and modified time as the original file. The new copy is stored in the current directory on the current drive. If the source file is on the current drive and in the current directory and you do not specify a different drive or directory for the destination file, the copy command stops and displays the following error message:

    File cannot be copied onto itself

    0 File(s) copied

  • Combining files

    This game was inspired by parkour, which is “ the activity or sport of moving rapidly through an area, typically in an urban environment, negotiating obstacles by running, jumping, and climbing” (Google Dictionary). You’re free.Soon, a trained assassin with a taser gun is following you. If you know nothing about parkour, don’t fret! Can you escape him?Game Features: Hundreds of parkour inspired action moves!This game has got some pretty cool moves (though don’t try this at home)! Vector game download. You can see for yourself in this game what the different moves are!

    If you specify more than one file in Source, copy combines them all into a single file using the file name specified in Destination. Copy assumes the combined files are ASCII files unless you use the /b option.

  • Copying zero-length files

    Copy does not copy files that are 0 bytes long. Use xcopy to copy these files.

  • Changing the time and date of a file

    If you want to assign the current time and date to a file without modifying the file, use the following syntax:

    The commas indicate the omission of the Destination parameter.

  • Copying files in subdirectories

    To copy all of a directory's files and subdirectories, use the xcopy command.

  • The copy command, with different parameters, is available from the Recovery Console.

Examples

To copy a file called Memo.doc to Letter.doc in the current drive and ensure that an end-of-file character (CTRL+Z) is at the end of the copied file, type:

To copy a file named Robin.typ from the current drive and directory to an existing directory named Birds that is located on drive C, type:

If the Birds directory does not exist, the file Robin.typ is copied into a file named Birds that is located in the root directory on the disk in drive C.

To combine Mar89.rpt, Apr89.rpt, and May89.rpt, which are located in the current directory, and place them in a file named Report (also in the current directory), type:

When you combine files, copy marks the destination file with the current date and time. If you omit Destination, the files are combined and stored under the name of the first file in the list. For example, to combine all files in Report when a file named Report already exists, type:

Windows Copying Files Onto Multiple Discs

To combine all files in the current directory that have the.txt file name extension into a single file named Combined.doc, type:

If you want to combine several binary files into one file by using wildcard characters, include /b. This prevents Windows from treating CTRL+Z as an end-of-file character. For example, type:

Caution

If you combine binary files, the resulting file might be unusable due to internal formatting.

In the following example, copy combines each file that has a .txt extension with its corresponding .ref file. The result is a file with the same file name but with a .doc extension. Copy combines File1.txt with File1.ref to form File1.doc, and then copy combines File2.txt with File2.ref to form File2.doc, and so on. For example, type:

To combine all files with the .txt extension, and then combine all files with the .ref extension into one file named Combined.doc, type:

Additional references

You can transfer files yourself if you’re moving from a Windows 7, 8, 8.1, or 10 PC. You can do this with a combination of a Microsoft account and the built‐in File History backup program in Windows. You tell the program to back up your old PC’s files, and then you tell your new PC’s program to restore the files.

However, you need a portable hard drive for this to work. Portable hard drives are fairly inexpensive, usually costing less than $100. But there’s a bonus: When you’re through transferring the files, the drive works perfectly for backing up your new computer.

To transfer files from an old Windows 7, 8, 8.1, or 10 computer to a new Windows 10 computer, follow these steps:

  1. If you’re running Windows 7 on your old PC, upgrade it to Windows 10.

    For many Windows 7 owners, this is probably a deal breaker. Unless, of course, you took advantage of the free Windows 10 upgrade offer that ended July 29, 2016. Now that the deadline has passed, Windows 7 owners might be better off by buying a file transfer program.If you’re running Windows 8, 8.1, or 10 on your old PC, move ahead to Step 2.

  2. If you’ve already been using File History on your old PC, jump to Step 5. Otherwise move to Step 3.
  3. Sign in with your Microsoft account on your old PC.

    When you sign in with a Microsoft account, Microsoft remembers many of your settings and services so it can duplicate them on other PCs you sign into.

  4. Plug the portable hard drive into your old PC and then set up File History to save your files onto the portable hard drive.

    File History comes built into Windows 8, 8.1, and 10. It could take anywhere from a few minutes to a few hours to back up your files for the first time.While File History backs up your files, it shows the statement “File History is saving copies of your files for the first time.” (It also lists the word Stop in case you want to stop the backup.)

    When File History has finished backing up your files to the portable drive, those words change to say “Files last copied,” followed by the date and time it finished backing up your files, as shown. At that point, move to Step 5.

  5. Sign into your new Windows 10 PC with the same Microsoft account you used on your old PC. Then plug the portable hard drive into your new computer.

    By signing in with your Microsoft account, your settings automatically transfer to your new PC. (The wallpaper on your new PC quickly changes to match your old PC, letting you know that something is happening.)

  6. Open File History and direct your new Windows 10 PC toward your old File History backup.
    On your new Windows 10 PC, click the Start button and type File History into the Search box and press Enter. The Control Panel’s File History window appears, as shown.

    Click the check box labeled I Want to Use a Previous Backup on this File History Drive. A window drops down, listing the backup you’ve made on your old PC. Click its name, and click the Turn On button.

    Your new PC begins backing up its files for the first time, but these incoming files won’t damage your old PC’s backup.

  7. Choose Restore Personal Files from the File History window’s left pane.
  8. Choose the files and folders to restore and then click the green Restore button.
    Click the Forward or Back arrows next to the big green button along the window’s bottom until you find the date and time of the files you’d like to restore.

    For example, if you used File History on your old PC for the first time in Step 4, click the Back arrow (on the left) until you’re at the Number 1 backup.

    If you’ve been using File History on your old PC all along, click the Forward arrow (on the right) to move to your most recent backup.

    When you’re viewing the files or folders you want to restore, click the green button found on the window’s bottom edge, shown here. File History begins copying your old PC’s files and folders onto your new PC.

Copying Windows Files Stuck Bootcamp

If there are no complications, your new PC should soon have the files and folders from your old PC.

Windows Copying Files

Moving files
  • If you’d already been using File History on your old PC, all of your old PC’s backups should still be available to you on your new PC.
  • Your new PC will continue to back up your new computer’s files to your portable hard drive. Keep the hard drive plugged in permanently. (Or, if you bought a new laptop or tablet, plug it in frequently so your computer can keep your backups current.)
  • If you’ve just borrowed a friend’s portable hard drive, you can unplug it at this point and give it back. But you should really have your own portable hard drive so you can begin backing up your new Windows 10 PC.
  • Your Microsoft account and File History can transport your settings and files to your new PC. However, you must still install all of your old desktop programs onto your new PC.
  • If you’re moving to Windows 10 from a Windows 8 or 8.1 PC, you can find your apps waiting for you in the Windows Store: Click your icon near the Store app’s upper‐right corner and choose My Library from the drop‐down menu. There you can find and download your old apps to your new PC.