Skip to content
View in the app

A better way to browse. Learn more.

Thailand News and Discussion Forum | ASEANNOW

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Xcopy

Featured Replies

Is there a set of switches for xcopy in Windows 7 that will allow me to copy a set of files from directory A to directory B where directory B already has some files from directory A without having to manually ok each copy? They are large files and I don't want to waste time copying files into B that are already there.

  • Author

And no, I'm not willing to install any flavour of Linux B)

  • Author

And I don't want to buy a Mac either :lol:

  • Author

I had a look through the xcopy switches before I posted and there doesn't seem to be a combination that will copy files from A to B unless they're already in B without manual intervention of some sort. I'll have a look at Robocopy - cheers.

google rysnc which would be free and works wonders.

From xcopy /?

/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.

I believe that is what you are looking for. Unless you meddle with the dates of the files some way.

But I agree with above, rsync is by far better and more advanced choice, it has an algorithm to copy only the deltas in case a larger file has changed plus other advanced options.

Very convenient for backups too.

What Nagatus said. Maybe with

/Y Suppresses prompting to confirm you want to overwrite an

existing destination file.

  • Author

What Nagatus said. Maybe with

/Y Suppresses prompting to confirm you want to overwrite an

existing destination file.

If there's an exiting destination file I don't want it to overwrite it - I just want it to leave it alone.

  • Author

Found that Microsoft's SyncToy does exactly what I want but thanks for all the suggestions.

Be careful with MS synctoy. I've had situations where I thought it copied everything but didn't ....

Found that Microsoft's SyncToy does exactly what I want but thanks for all the suggestions.

SyncToy can be dodgy at times. I've had my share of problems, so take care.

The easiest solution would be to use a batch file. I can write one up that will do exactly what you want -- copy from dir A to dir B without overwriting existing files in dir B (silent mode). If the SyncToy doesn't live up to expectations, let me know.

Why would you want to use Xcopy unless you are using it in a batch file? With Windows 7 when you copy files from directory A to directory B using the Windows explorer UI. The fist time it discovers a duplicate file it prompts you how you want to resolve the issue; replace, rename, or skip. There is also a check box to tick which will repeat this action for the remaining conflicts without prompting again.

I think I'm missing something here.

  • Author

Why would you want to use Xcopy unless you are using it in a batch file? With Windows 7 when you copy files from directory A to directory B using the Windows explorer UI. The fist time it discovers a duplicate file it prompts you how you want to resolve the issue; replace, rename, or skip. There is also a check box to tick which will repeat this action for the remaining conflicts without prompting again.

I think I'm missing something here.

Because I'm happy with the command line and, as I said, I would like to simply copy new files into a directory without having to 'tick a box' every time I do it.

  • Author

Found that Microsoft's SyncToy does exactly what I want but thanks for all the suggestions.

SyncToy can be dodgy at times. I've had my share of problems, so take care.

The easiest solution would be to use a batch file. I can write one up that will do exactly what you want -- copy from dir A to dir B without overwriting existing files in dir B (silent mode). If the SyncToy doesn't live up to expectations, let me know.

I'd appreciate the batch file anyway if it's not too much trouble.

Here you go...

@echo off &setlocal enabledelayedexpansion
COLOR 17

:sPrmpt
cls
echo.
echo Specify the full path to 'source' and 'target' directories.
echo  (e.g., C:\My Backup) 
echo.
echo.
set src=
set /p src=Source: 
if /I "%src%"=="" goto sPrmpt
if exist "%src%\" (
cd /d "%src%"
goto tPrmpt
) else (
echo "%src%" is not a valid path.
echo.
pause
goto sPrmpt
)

:tPrmpt
echo.
set dest=
set /p dest=Target: 
if /I "%dest%"=="" goto tPrmpt
if exist "%dest%\" (
goto confrm
) else (
echo "%dest%" does not exist.
)
echo.
:mkfldr
set add=
set /p add=Do you want to create it [y/n]? 
if /I "%add%"=="y" (
md "%dest%"
goto confrm
)
if /I "%add%"=="n" (
goto tPrmpt
)
goto mkfldr

:confrm
cls
echo.
echo Quick Summary
echo -------------
echo.
echo Source:       %src%
echo Destination:  %dest%
echo Overwrite:    No
echo Savelog:      Yes
echo.
set /p ans=Proceed [y/n]? 
if /I "%ans%"=="y" goto Runcmd
if /I "%ans%"=="n" goto Quit
goto confrm

:Runcmd
set LOG=%dest%\filecopy.log

echo.>>"%LOG%"
echo [%date% %time%]>>"%LOG%"

set count=0
set EL=errorlevel 1
for %%a in (*.*) do (
if not exist "%dest%\%%a" xcopy /f "%%a" "%dest%">>"%LOG%"
if not %EL% set /a count=!count!+1
)
echo.
echo.
echo %count% files copied.

:Quit
echo. 
echo Press any key to exit.
pause >nul

EXIT

What this does:

1. Asks you to specify source and target folders

(you also have option to create the latter if one does not exist)

2. Copies files only if not exist at destination

3. Logs all file copy operations at the target location

  • Author

Thanks very much. Really appreciate that. You'd think there'd be a switch built in to xcopy though. I'd expect that it's a common occurrence for people to want to copy stuff from here to there unless it's there already.

Again - cheers!

I've noticed a file size discrepancy when copying the formatted code above to Notepad and saving it using Windows default encoding. However, the pasted code is 100 percent identical when compared to the original, with the only difference being in size (1,446 vs 1,355). I wonder what's that all about?

I've attached the original file below. Download if copy/paste gives you problems.

Filecopy.rar

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.