DOCUMENT:Q103040 02-SEP-1993 [W_NT] TITLE :PRB: Renaming Files While Copying May Cause Corruption PRODUCT :Windows NT PROD/VER:3.10 OPER/SYS:WINDOWS KEYWORDS: ---------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows NT operating system, version 3.1 - Microsoft Windows NT Advanced Server, version 3.1 ---------------------------------------------------------------------- SYMPTOMS ======== With the Windows NT command prompt, if you use the Copy command to copy a file from one directory to another, you cannot rename the file simultaneously if you are using wildcards in the command line. For example, if you have one file called TEST.EXE in a directory called ATEST, and you want to rename the file to BINARY.EXE while copying it, the file will be corrupted if you use the following command line: copy c:\atest\*.exe c:\binary.exe The file will be partially copied, but will truncate at the first instance of CTRL-Z (EOF) in the file, causing a corrupted file. RESOLUTION ========== To workaround this problem, use a /b switch in front of the source file. This will correctly complete the copy and rename operation. For example: copy /b c:\atest\*.exe c:\binary.exe Do not place the /b after the destination file. If you use a /b after the destination file as in the following example, the destination file will be corrupted: copy c:\atest\*.exe c:\binary.exe /b Also, using the following command is the best way to copy and rename a file: copy c:\atest\test.exe c:\binary.exe STATUS ====== Microsoft has confirmed this to be a problem in Windows NT version 3.1 and Windows NT Advanced Server version 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. Additional reference words: 3.10 cmd KBCategory: KBSubcategory: ntap filsys ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1993.