xcopy

Reference a Volume/Drive by Label

走远了吗. 提交于 2019-11-28 01:38:08
问题 I'm trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like to be able to do this by referencing the volume label instead of the drive letter. Any ideas? An hour of Google-ing has proved fruitless. :( 回答1: This command should discover the drive with the correct label and store the drive letter (with colon) in variable "usb" for /f %%D in ('wmic volume get DriveLetter^, Label ^| find

xcopy wildcard source folder name to destination

旧巷老猫 提交于 2019-11-28 01:14:29
问题 I want to copy from a wildcard source folder to a destination folder: xcopy a:\parentfolder\n* x:\parentfolder Only folders starting with "n" should therefore be copied to the destination. Any help to get this working would be much appreciated. 回答1: for /f "delims=" %%a in ('dir /b/ad "a:\parentfolder\n*" ') do xcopy "a:\parentfolder\%%a\*" x:\parentfolder\ As you have it, XCOPY assumes that n* is a filespec, and there's no way to tell it otherwise. 回答2: If you first CD to the folder you want

Why does xcopy exit with code 9009 in Visual Studio post-build step?

我的未来我决定 提交于 2019-11-27 21:01:47
I am getting the following error, which I don't understand. Any suggestions? Error 1 The command "xcopy "D:\Users\johndoe\Documents\Visual Studio 2008\Projects\MyProject\MyProject.Modules.Ribbon\bin\Debug\MyProject.Modules.Ribbon.dll" "D:\Users\johndoe\Documents\Visual Studio 2008\Projects\MyProject\MyProject\bin\Debug\Modules\" /Y" exited with code 9009. MyProject.Modules.Ribbon Jobrocol I encounted this error on the TeamCity build server. I finally resolved it after checking the build log and found: "'xcopy' is not recognized as an internal or external command." I then changed my statement

What is going wrong when Visual Studio tells me “xcopy exited with code 4”

二次信任 提交于 2019-11-27 19:12:25
I'm not very familiar with post-build events, so I'm a little confused as to what's going wrong with my program. When compiling in visual studio 2010, I get the following: The command "xcopy C:\Users\Me\Path\Foo.bar\Library\dsoframer.ocx C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D xcopy C:\Users\Me\Path\Foo.bar\ApplicationFiles C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D xcopy C:\Users\Me\Path\url\ C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D rmdir /S /Q C:\Users\Me\Path\Foo.bar\bin\Debug\.gwt-tmp" exited with code 4. The program appears to run fine, despite this error, but I don't want to

How do I find files with a path length greater than 260 characters in Windows?

给你一囗甜甜゛ 提交于 2019-11-27 16:55:29
I'm using a xcopy in an XP windows script to recursively copy a directory. I keep getting an 'Insufficient Memory' error, which I understand is because a file I'm trying to copy has too long a path. I can easily reduce the path length, but unfortunately I can't work out which files are violating the path length restriction. The files that are copied are printed to the standard output (which I'm redirecting to a log file), but the error message is printed to the terminal, so I can't even work out approximately which directory the error is being given for. do a dir /s /b > out.txt and then add a

DOS下用XCOPY命令复制文件

喜夏-厌秋 提交于 2019-11-27 12:00:44
一、XCOPY命令举例说明 1)、 XCOPY D:\data E:\data /S /E /Y 说明:把D盘中的data文件夹下面的所有文件夹全部复制到E盘data这个文件夹下去,其中包含空的文件夹,在复制过程中不作覆盖方式提示。 2)、 XCOPY \\192.168.1.2\data E:\data /S /E /Y 说明:把192.168.1.2计算机中的data文件夹下面的所有文件夹全部复制到E盘data这个文件夹下去,其中包含空的文件夹,在复制过程中不作覆盖方式提示。 3)、 XCOPY D:\*.* E:\D_BAK /S /H /E /Y 说明:把D盘中的所有文件夹全部复制到E盘D_BAK这个文件夹下去,其中包含空的文件夹和隐藏文件,在复制过程中不作覆盖方式提示。 二、XCOPY命令参数 命令格式:XCOPY source [destination] [命令参数] 命令参数介绍 source 指定要复制的文件。 destination 指定新文件的位置和/或名称。 /A 只复制有存档属性集的文件, 但不改变属性。 /M 只复制有存档属性集的文件, 并关闭存档属性。 /D:m-d-y 复制在指定日期或指定日期以后改变的文件。如果没有提供日期,只复制那些源时间比目标时间新的文件。 /EXCLUDE:file1[+file2][+file3]...

Using xcopy to copy files from several directories to one directory

自闭症网瘾萝莉.ら 提交于 2019-11-27 11:42:13
问题 Is it possible to use xcopy to copy files from several directories into one directory using only one xcopy command? Assuming that I have the directory tree root\Source\Sub1\Sub2 I want to copy all .xml files from the directory root\Source including sub folder to root\Destination. I don't want to copy the folder structure, just the files. 回答1: As DandDI said, you don't need xcopy. for statement helps much. However, you don't need to state process outcome of dir command as well, this command

Why would a post-build step (xcopy) occasionally exit with code 2 in a TeamCity build?

别来无恙 提交于 2019-11-27 09:55:11
问题 A few projects in my client's solution have a post-build event: xcopy the build output to a specific folder. This works fine when building locally. However, in TeamCity, I occasionally get xcopy [...] exited with code 2 If I use regular copy , it exits with code 1. I expect this has something to do with file locks, although the specific files being copied are not the same, so perhaps just locking on the shared destination directory. I use /y to not prompt on overwriting files. Why this fails

“invalid path 0 files copied” Error while using xcopy command

馋奶兔 提交于 2019-11-27 08:21:39
Hi I have this little command to copy files in a batch, which will help because I do this specific copy multiple times a day. The problem occurs while using the xcopy command. Everything is in order, but I am receiving this error: "Invalid path 0 files copied". Here is the code: C:\Windows\System32\xcopy /Y "C:\Users\Ryan\Desktop\mmars_pub\" "C:\Users\Ryan\Desktop\Dropbox\MMARS\mmars_pub\" I'm using the full path to the xcopy executable because I was having trouble configuring the path environment variable to function properly. I would imagine that it shouldn't affect the result though. I read

batch file Copy files with certain extensions from multiple directories into one directory

最后都变了- 提交于 2019-11-27 06:19:14
I'm a newbie, so bear with me... I am trying to copy all .doc files that I have scattered throughout several subdirectories of one main directory into another directory using a batch file. I have managed to get a filelist.txt of all the files (there are hundreds) out of these directories that I want to copy using: "C:\Main directory\sub directory" dir /b /s *.doc > "C:\Main directory\sub directory\filelist.txt" What script would I use to xcopy those into one directory? Can I use some code that actually grabs those file names from filelist.txt and xcopies them? For reference, I looked at the