Questions tagged [xcopy]

xcopy is a Windows command to copy all files, directories, and subdirectories from a specified path to a target directory

Documentation:

  1. TECHNET
  2. SS64

Related commands:

  1. COPY
  2. ROBOCOPY
797 questions
5
votes
5 answers

Copy Files with exact Structure into another Directory using XCopy

Think I want to copy this file C:\Majid\File\text.txt to D:\Copied (C:\Majid\File\text.txt ---> D:\Copied) I want to use Xcopy to copy that file with its full directory into D:\Copied, then I should have something like this --->…
Inside Man
  • 4,194
  • 12
  • 59
  • 119
5
votes
1 answer

Test IF file exist, ELSE xcopy these two files

Morning all. So I've been up hours trying to cobble together -a variety of replies to other posts- into my own code in order to see if I could get something usable. No-go. I'm sufficiently lost in the sauce that I've now got to ask for some help…
5
votes
9 answers

Alternatives to XCopy for copying lots of files?

The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort. I recently received a non-pieceofcrapuous laptop, and I am in…
Danimal
  • 7,672
  • 8
  • 47
  • 57
5
votes
3 answers

Why does xcopy not copy files when using these parameters?

I have a simple xcopy script that I'm running from the command line that reads a CSV file of directories and file names. I've used a very similar script with no problems before. Here is the script: Z:\HOME\>for /f "delims=, tokens=1,2,3,4" %i in…
Saggio
  • 2,212
  • 6
  • 33
  • 50
5
votes
2 answers

bat file commands - how to cut file and replace existing file

I need to swap out a file with data (original) to a dummy file with no data. I need to switch back and forth between these tow files on a regular basis. As a safe way to not delete files, I thought the best way would be to rename the original file,…
Kalamalka Kid
  • 240
  • 4
  • 14
5
votes
2 answers

xcopy cyclic copy .txt files

I am trying to use XCopy to copy all text files of folder structure to another folder, while copying the subfolder structure. Here is what I have xcopy /s "./Folder1/*.txt" "./Folder2/ The error I am getting is " Cannot perform a cyclic copy" Any…
Benjamin Jones
  • 987
  • 4
  • 22
  • 50
5
votes
3 answers

Batch file to copy from remote desktop to local machine

How do I copy a file from a remote desktop user's drive to my local machine using xcopy or any other protocol? My server path is \\\Trail01 and the file location is: C:\Users\ashique.sheikh\Desktop\Day2.R How can I use this is in my batch file? I…
Ashique Sheikh
  • 155
  • 2
  • 4
  • 13
5
votes
2 answers

Overwrite a read-only file in batch with xcopy

We have an internal excel addon we deploy on a regular basis across a number of UNC directories. Each copy is set to read only so that the users can't alter it on accident. The "deployment" process involves going to each directory, and copying the…
sten
  • 380
  • 1
  • 5
  • 14
5
votes
0 answers

Copy Files in Visual Studio Post Build Event

I want to copy all files recursivly with given file extensions after the build process succeeds. Robocopy ROBOCOPY %source% %destination% /S *.as?x *.xls? *.mrt xcopy xcopy .\*.as?x %destination% /SY xcopy .\*.xls? %destination% /SY xcopy .\*.mrt…
Marko
  • 1,291
  • 1
  • 21
  • 37
5
votes
4 answers

Batch file error: "xcopy is not recognized as an internal or external command..."

I'm programming a batch file and after a long amount of code, I have: :d1copy xcopy /Y "C:\Users\Joseph\Desktop\JOKO_Sync\*.*" "F:\JOKO_Sync\*.*" /s /e /V /D pause When I execute this, I get the error xcopy is not recognized as an internal or…
JSUPRA
  • 61
  • 1
  • 1
  • 4
5
votes
2 answers

Folder Names with Spaces in XCOPY doesn't work?

Working on a batch script that backs up various important folders on my PC, I have ran into a problem. I can't seem to copy folders that have a space in their name. If there is a sub-folder that has a space and it's parent doesn't, It works…
user1739467
5
votes
2 answers

xcopy with MsBuild

I have a really simple build script that looks like this:
Pelle
  • 2,755
  • 7
  • 42
  • 49
4
votes
1 answer

How to exclude a file type in XCOPY without passing a file?

I have 5 txt files in my C drive, say result_1.0.1.txt result_1.0.1_tmp1.txt result_1.0.1_tmp2.txt result_1.0.1_tmp3.txt result_1.0.1_tmp4.txt At any point, there will be only 1 valid result txt file (in this case it is result_1.0.1.txt), and…
Sandeep
  • 5,581
  • 10
  • 42
  • 62
4
votes
1 answer

XCopy is not working (File not found *.*)

I'm tyring to copy a folder from my Visual Studio 2015 Project's root directory into the output directory (as it breaks the application without it), so I decided to add xcopy to the post-build commands. xcopy "$(SolutionDir)Content\*.*"…
Hyblocker
  • 101
  • 4
  • 11
4
votes
1 answer

Why do XCOPY /W and REPLACE /W consume all redirected text data for their one-character prompt?

When having a text file test.txt containing this1: test data The following code returns the content of the text file with the first character removed: < "test.txt" ( > nul pause findstr "^" ) The same happens when using a pipe: type…
aschipfl
  • 33,626
  • 12
  • 54
  • 99