endure Posted February 7, 2011 Share Posted February 7, 2011 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. Link to comment Share on other sites More sharing options...
endure Posted February 7, 2011 Author Share Posted February 7, 2011 And no, I'm not willing to install any flavour of Linux Link to comment Share on other sites More sharing options...
endure Posted February 7, 2011 Author Share Posted February 7, 2011 And I don't want to buy a Mac either Link to comment Share on other sites More sharing options...
Supernova Posted February 7, 2011 Share Posted February 7, 2011 Xcopy switches You could also use the more powerful Robocopy or try RichCopy. Link to comment Share on other sites More sharing options...
endure Posted February 7, 2011 Author Share Posted February 7, 2011 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. Link to comment Share on other sites More sharing options...
RKASA Posted February 8, 2011 Share Posted February 8, 2011 google rysnc which would be free and works wonders. Link to comment Share on other sites More sharing options...
Nagatus Posted February 8, 2011 Share Posted February 8, 2011 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. Link to comment Share on other sites More sharing options...
Phil Conners Posted February 8, 2011 Share Posted February 8, 2011 Roadkil's Unstoppable Copier http://www.roadkil.net/program.php?ProgramID=29 does what you're looking for. Free. Link to comment Share on other sites More sharing options...
JSixpack Posted February 8, 2011 Share Posted February 8, 2011 What Nagatus said. Maybe with /Y Suppresses prompting to confirm you want to overwrite an existing destination file. Link to comment Share on other sites More sharing options...
endure Posted February 8, 2011 Author Share Posted February 8, 2011 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. Link to comment Share on other sites More sharing options...
endure Posted February 8, 2011 Author Share Posted February 8, 2011 Found that Microsoft's SyncToy does exactly what I want but thanks for all the suggestions. Link to comment Share on other sites More sharing options...
Phil Conners Posted February 9, 2011 Share Posted February 9, 2011 Be careful with MS synctoy. I've had situations where I thought it copied everything but didn't .... Link to comment Share on other sites More sharing options...
Supernova Posted February 9, 2011 Share Posted February 9, 2011 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. Link to comment Share on other sites More sharing options...
BB1950 Posted February 9, 2011 Share Posted February 9, 2011 (edited) 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. Edited February 9, 2011 by BB1950 Link to comment Share on other sites More sharing options...
endure Posted February 9, 2011 Author Share Posted February 9, 2011 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. Link to comment Share on other sites More sharing options...
endure Posted February 9, 2011 Author Share Posted February 9, 2011 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. Link to comment Share on other sites More sharing options...
Supernova Posted February 10, 2011 Share Posted February 10, 2011 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 Link to comment Share on other sites More sharing options...
endure Posted February 10, 2011 Author Share Posted February 10, 2011 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! Link to comment Share on other sites More sharing options...
Supernova Posted February 10, 2011 Share Posted February 10, 2011 (edited) 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 Edited February 10, 2011 by Supernova Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now