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
3
votes
1 answer

Copy file to user folder with a command line

I have search the web high and low, but can not find away to copy a file to the desktop with a command line. Xcopy File.exe c:/users/%username%/desktop This gives me a error like Access denied I look in to robocopy also, with no luck. Is there…
Torbjörn Dahlgren
  • 111
  • 1
  • 1
  • 11
3
votes
1 answer

how to copy updated files to new folder and create directory as source if not exist?

I was trying to compare files in 2 folders and copy those new and updated files to a diff folder, for example: newFolder has a\aa.txt (new folder and new file) b\aa.txt b\ab.exe (modified) b\ac.config (new file) aa.txt (modified) ab.exe…
Duke Wang
  • 83
  • 3
  • 10
3
votes
1 answer

Excluding directories using wildcards

I using xcopy, and I am trying to exclude directories with specific ending name from copying. I've put the bellow line in exclude_files.txt to ignore those directories: \\\*_bkup\\ Also, the xcopy command is the one bellow: xcopy "C:\localfolder"…
Adrian Cumpanasu
  • 1,028
  • 1
  • 10
  • 24
3
votes
1 answer

How to delete all files/folders from a folder 'A' which are not present in the folder 'B', using Windows Batch Scripting?

How to delete all files/folders from a folder 'A' which are not present in the folder 'B', using Windows Batch Scripting? For example, Folder A has following contents: Dir1 -> File1 Dir2 (no files) Dir3 -> File2 Dir4 (no files) File3 File4 Dir5 ->…
raptor
  • 33
  • 1
  • 4
3
votes
2 answers

Copying files as administrator in a batch file

So I have a batch file that copies files from one folder to a bunch of different folders. The purpose of this batch file is to be like a simple installer(Without registry edits) to make it easier for others to use a set of files I am distributing.…
user2997716
  • 53
  • 1
  • 2
  • 6
3
votes
1 answer

Xcopy command: How to display only the destination path of files copied

I am using the xcopy command like this - xcopy /y/i/e/f \oldLocation \newLocation and i get output like this: D:\temp\src\a.txt-> C:\Temp\a.txt I need the xcopy to give me the complete path for just the destination files (only C:\Temp\a.txt) ,…
3
votes
1 answer

Expand directory list and copy

I need to copy the following subset of folders from $sourceDir to $targetDir: abc0001 abc0643 abc0456 ... The number of folders is unknown, but they all match a pattern abc0*. Is there an elegant solution to expand abc0* to the actual list of…
Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
3
votes
4 answers

How to append date to directory path in xcopy

I do have a xcopy statement in bat file.. would you please help me to append today's date to one of directories in destination xcopy /S /E /I %sourceFolder% "C:\Shared\copy\%destinationFolder%" today date is 06072013 so I want my destination look…
user2434611
  • 125
  • 2
  • 3
  • 6
3
votes
3 answers

Batch move with exceptions? Or using xcopy and deleting original after?

I have a script that extracts all files from all sub-directories and deletes the empty sub-directories afterwards, the part that extracts reads: for /r %%a in (*.*) do move "%%a" "%~dp0" Is there a way to do this with the exception of…
Insarov
  • 971
  • 1
  • 10
  • 15
3
votes
1 answer

Script: To automatic move files from 1 folder to another

I would like to have a script to monitor a folder and when a .mp3 or .m4a file is added it would be automatic copy it to another folder.
Sander Kruis
  • 41
  • 2
  • 6
3
votes
1 answer

How do I copy file and folder structure using xcopy from a text file?

I have a text file containing a list of files and folders. What I want to do is use xcopy to replicate what is written in the text file. My text file looks like this: "C:\FOLDER" …
Andrew
  • 293
  • 6
  • 14
3
votes
1 answer

Xcopy display filenames only. Not full directory path

Any way when copying files via Xcopy (via batch) to output the filenames of the files being copied - or better yet, the base folder and filename - rather than the whole directory path? The batch uses %USERPROFILE%\Desktop which resolves to…
Rik
  • 91
  • 1
  • 10
3
votes
1 answer

Batch file to copy from all user profiles

I want to generate a batch file that will copy all *.doc and *.xls file types from a user's profile. I will then set the batch file to run automatically via Scheduled Tasks after-hours when all users are logged out. Here is what I have: for %%x in…
user1411190
  • 31
  • 1
  • 1
  • 2
3
votes
1 answer

Visual Studio Post Build Event - xcopy to different relative directory

Essentially, what I want to do is use a wildcard for a directory. The post build event is on a PageComponents project: PageComponents WidgetTemplates WidgetTemplate1 Usercontrol1 WidgetTemplate2 …
2
votes
2 answers

Windows batch file all encompassing error levels

I have a batch file which just does a load of copy and xcopy commands, if any of them fail I need to jump out of the copying to a goto label, but it would be very inconvenient to have to check errorlevels after every single copy. I suspect it may…
Bill Walton
  • 811
  • 1
  • 16
  • 31