1.    24 Oct 2016 #1

    command line to copy files from dir A to B but skip existing ones


    Hi there

    Is there a Windows command that can copy files from say directory A to directory B but skip any with the same name I don't want to update even if say directory A has a newer version than directory B --simply use existing names --if it exists skip.

    I'm trying to replicate the Linux command :

    rsync -a -v --ignore-existing <src> <dst> where src is source directory and dst is destination / target directory (or device etc)

    (This command also has options to OVERWITE target directory with newer file -- I don't want that option yet - the example I gave will ignore existing files if they already exist in the target directory. Note also - this doesn't CARE what's in the files - it's purely on the NAME - no dates / attributes /size etc considerations are checked - simply the NAME - which is why this job can be lightning fast even for quite a lot of files.

    What I'm trying to do is automate sending files to a NAS server every so often (say once a day / week) from WINDOWS clients when new files have been created --I don't need to backup all the windows clients - users can do that themselves - There's a job on the Clients that can backup / restore their desktop in entirety which is run on demand.

    Any ideas --shouldn't be too hard but I don't really know too much of Windows possibilities from the CLI.

    Note I don't want a GUI --need a command as this will be (eventually) an automated background process on the Windows clients.

    I did see there's an experimental Bash interface - but putting that in the hands of inexperienced users would probably be a recipe for DISASTER !!!.

    Cheers
    jimbo
      My System SpecsSystem Spec


  2. Joined : Oct 2013
    Newport, South Wales, UK
    Posts : 1,145
    Windows 10 Pro x64 - XP/Vista/Win7/Win8.1 in VM for testing
       24 Oct 2016 #2

    SyncToy is the app that comes to mind - If it's still available. Not command line but simple GUI

    What I've done in the past is create backup/update/copy routines until they are reliable and fine tuned to meet all eventualities then create a shortcut for each, (option is included in software), and this is all the user gets access to

    Download SyncToy 2.1 from Official Microsoft Download Center

    There is the robocopy command which may be of use if you have to use command line Try robocopy /?
      My System SpecsSystem Spec

  3.    24 Oct 2016 #3

    Barman58 said: View Post
    SyncToy is the app that comes to mind - If it's still available. Not command line but simple GUI

    What I've done in the past is create backup/update/copy routines until they are reliable and fine tuned to meet all eventualities then create a shortcut for each, (option is included in software), and this is all the user gets access to

    Download SyncToy 2.1 from Official Microsoft Download Center
    Hi there

    Thanks for the suggestion -- looks good and probably best on offer - however I'm really trying to get a 100% background batch job to run --want it to be as automatic and as "user-proof" as possible.

    Thanks again for suggestion anyway as that program is good for other things too.

    I've had problems with Robocopy in the past --- could also be my fault (always RTFM !!!!!) but I might also give it another go.

    rsync is really good though if you use it properly --btw you must add a / to the end of the first directory in the source command or it will copy the WHOLE directory into the target -- e.g A will become A.A !!!! where A is within A.

    Cheers
    jimbo
      My System SpecsSystem Spec


  4. Joined : Oct 2013
    Newport, South Wales, UK
    Posts : 1,145
    Windows 10 Pro x64 - XP/Vista/Win7/Win8.1 in VM for testing
       24 Oct 2016 #4

    Did you see my edit on Robocopy? It's not something I use but others swear by it. you could also use the shortcut data from Synctoy to use it inside a batch
      My System SpecsSystem Spec

  5.    24 Oct 2016 #5

    Barman58 said: View Post
    Did you see my edit on Robocopy? It's not something I use but others swear by it. you could also use the shortcut data from Synctoy to use it inside a batch
    Hi there.

    @Barman58

    The Robocopy scheme works -thanks --but :

    Robocopy doesn't seem have an option to ignore date / timestamp on output directory -- it says ignore if source older than dest OR ignore if source newer than dest. Not sure if you can combine these !!

    I'm trying to make 2 scenarios -- copy so long as file doesn't exist on target (any date), or copy regardless --i.e overwrite target if it exists.

    The users want to have a choice -- sometimes when copying files they are working on something and don't want the original to be overwritten. I know you can encourage them to create a new file until they've finished with their changes --but have you ever tried "Educating Users" !!!!!!!

    Pity Files don't have a thing like the IBM mainframes did where you had "generation" names automatically generated such as file_name(0), file_name(-1), file_name(+1) etc. !!

    Cheers
    jimbo
      My System SpecsSystem Spec


  6. Joined : Oct 2013
    Newport, South Wales, UK
    Posts : 1,145
    Windows 10 Pro x64 - XP/Vista/Win7/Win8.1 in VM for testing
       24 Oct 2016 #6

    You may be able to create two, (or several), different variations to overwrite or not, and create, and present, Short-cuts to the user, or probably, better for you, create a command line instruction from the shortcut to add to the batch files
      My System SpecsSystem Spec


 


Similar Threads
Thread Forum
Solved Launch Windows Update from Command line?
Need to open windows update, but it's not where it used to be and I can't use the start button....... How can I open it?
Windows Updates and Activation
Solved Can't add user via command line
I am trying to add a user via the command line through a virtual pc I added with VMWare. I'm running windows 10, and unable to add because this is what I get when I open CMD: I can't go beyond this point, I keep getting error messages. Any help...
User Accounts and Family Safety
Command-line method using clipboard to copy multiple images
After a lot of searching i have only found two possible tools that might do this. The one that seems rated best is called CopyQ. While it did install and appears to be available, I cannot seem to state to function correctly to get it to copy an...
General Support
How to connect/disconnect to a VPN using the command line?
Hi all I have several network connections configured. There is one wifi connection which automatically connects to my WLAN, another cable based LAN connection to a NAS which is used for backups and some L2TP connection connections (used...
Network and Sharing
Can restore of Win 7 be started from command line ?
For some unknown reason I cannot any more navigate to Update panel from "Einstellungen" - it is blocked. I have to cancel the "Einstellungen" window by the task manager ! So in this moment I cant go forward nor backward any more: cant...
Installation and Setup
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 20:05.
Find Us
Twitter Facebook Google+



Windows 10 Forums