I tried the Windows 10 copy command from a command prompt as follows:

copy "c:\folderA" "d:\folderB"

Which resulted in folderB being a file, instead of a new folder with the contents of folderA. Is there any way for me to extract the contents of the folderB file back into a folder? If I open the folderB file in a text editor, the first thing in the file is "SQLite format 3".

If there is a solution posted, please point me in the direction of it. I searched for a solution without any luck.

  • 2
    Do you still have access to the source folder? Can you just copy the files again the correct way? – music2myear Mar 29 at 20:03
  • Unfortunately no. I was making backups from a drive I no long have to a backup drive. I am trying to restore from my backup drive. – mhck Mar 29 at 20:40
  • Got it. Unfortunately this means you're up a creek without a paddle. As others have noted, these files have been converted to text as well as being merged into a single file. Any of the files that were binary in the source are gone. Text files MAY be able to be recreated. – music2myear Mar 30 at 3:25

Your files were concatenated and you may need to edit the folderB file with a text editor to separate it manually into the original files.

Note that this will only work if folderA had contained text files, not binary files. The reason is that the default option of copy is /A to copy text files. For copying binary files, one needs to specify the parameter of /B.

For that reason, if folderA had contained binary files, they were destroyed or truncated by the copy, so salvage is impossible.

| improve this answer | |

I can replicate the situation in which the expected target location results in a concatenated file containing all the files from the source folder (a little similar to a ZIP file, but then with wrong/bad contents inside).

To get rid of the issue, I suggest that you rename "d:\folderB" to, for example, "d:\backup_concatenated" (for backup reasons...).

Then you can start over using :

mkdir "d:\folderB"    
copy "c:\folderA" "d:\folderB"

That way, you will firstly create the target folder. Secondly, you can copy the files from "c:\folderA" to "d:\folderB".

Please note : this copy command will NOT copy any subfolders and will SKIP hidden/system files. That way, it cannot be used to create a full backup copy of the source folder !

To make things somewhat more convenient, I prefer using a tool like 'Total Commander' (or FAR Manager) for this kind of jobs...

| improve this answer | |
  • In case you don't have access to the source folder anymore (c:\folderA), then I suggest using special tools to copy the contents of the concatenated 'folderB' file back to separate files, and/or perhaps using a tool like Recuva on the original disk (if possible). – Pieter_Degroote Mar 29 at 21:01
  • 1
    In case you still have the original disk for use with Recuva, then make sure you do not do anything else with the original disk. – Pieter_Degroote Mar 29 at 21:12

For copies of folders, subfolders, containing files or not, use xcopy instead copy command...

xcopy /e /v /c /i /q /g /h /r /k /y "c:\folderA" "d:\folderB"

  • Bellow the xcopy /? command help outputs:
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A           Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M           Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P           Prompts you before creating each destination file.
  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V           Verifies the size of each new file.
  /W           Prompts you to press a key before copying.
  /C           Continues copying even if errors occur.
  /I           If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
  /Q           Does not display file names while copying.
  /F           Displays full source and destination file names while copying.
  /L           Displays files that would be copied.
  /G           Allows the copying of encrypted files to destination that does
               not support encryption.
  /H           Copies hidden and system files also.
  /R           Overwrites read-only files.
  /T           Creates directory structure, but does not copy files. Does not
               include empty directories or subdirectories. /T /E includes
               empty directories and subdirectories.
  /U           Copies only files that already exist in destination.
  /K           Copies attributes. Normal Xcopy will reset read-only attributes.
  /N           Copies using the generated short names.
  /O           Copies file ownership and ACL information.
  /X           Copies file audit settings (implies /O).
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.
  /B           Copies the Symbolic Link itself versus the target of the link.
  /J           Copies using unbuffered I/O. Recommended for very large files.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.