Batch file gurus: how to copy don't miss it that files between parallel folder by using UNC paths trees

The problem: you have two directories structures identical, a source and a target.  (Let's say \\srchost\srcfolder and c:\destfolder.)  The goal: using a batch file in Windows XP, browse to the source folders and add all files to the destination tree that do not already exist there.  We are not concerned with the dates, only if the file exists.

The Replace command has a parameter /a which will do that to a single file, but it will not browse.

Using the command ForFiles to browse directories and pass them to replace does not work because it does not support UNC paths.

Winds with the command For being... infernal.  Here is some of the best I have to this day, in the form of a batch file called with the paths of the src and dest as parameters:

Set srcpath = % ~ f1
the value destpath = % ~ f2
for/r % srcpath % (.) DO)
Set tmpsrc = %% ~ fi
Set tmpdest = % destpath
otherwise! tmpsrc! is % srcpath % set tmpdest = call! tmpdest! tmpsrc: % % = srcpath!
replace/a! tmpsrc! \ *. * « ! tmpdest! »
)

I think we can all agree this is really obnoxious, especially because it works only if you start the shell with the V switch: WE.

This turns into an unhealthy obsession for me.  I wanted a simple batch file solution to this since, oh, around 1990.  Surely, there must be a better way!  Can someone enlighten me?

And just at the head of some obvious answers:

1. No, I don't have the option to install just .

2. do not forget that it must work with the UNC paths, so ForFiles is out.

Thank you for your ideas!  I really sleep better if there is a healthy way to run this seemlingly simple task.

-Roy

Robocopy with . /XF looks like a possibility.

"Roy Feague" wrote in the new message: * e-mail address is removed from the privacy... *

The problem: you have two directories structures identical, a source and a target.  (Let's say \\srchost\srcfolder and c:\destfolder.)  The goal: using a batch file in Windows XP, browse to the source folders and add all files to the destination tree that do not already exist there.  We are not concerned with the dates, only if the file exists.

The Replace command has a parameter /a which will do that to a single file, but it will not browse.

Using the command ForFiles to browse directories and pass them to replace does not work because it does not support UNC paths.

Winds with the command For being... infernal.  Here is some of the best I have to this day, in the form of a batch file called with the paths of the src and dest as parameters:

Set srcpath = % ~ f1
the value destpath = % ~ f2
for/r % srcpath % (.) DO)
Set tmpsrc = %% ~ fi
Set tmpdest = % destpath
otherwise! tmpsrc! is % srcpath % set tmpdest = call! tmpdest! tmpsrc: % % = srcpath!
replace/a! tmpsrc! \ *. * « ! tmpdest! »
)
I think we can all agree this is really obnoxious, especially because it works only if you start the shell with the V switch: WE.

This turns into an unhealthy obsession for me.  I wanted a simple batch file solution to this since, oh, around 1990.  Surely, there must be a better way!  Can someone enlighten me?

And just at the head of some obvious answers:

1. No, I don't have the option to install just .
2. do not forget that it must work with the UNC paths, so ForFiles is out.
Thank you for your ideas!  I really sleep better if there is a healthy way to run this seemlingly simple task.
-Roy

Tags: Windows

Similar Questions

  • In bulk to rename files in a folder by using the DOS command line or a batch file.

    Can someone help with this problem, please?  I remember seeing the DOS command line to do a mass renaming of files in a folder or a batch file. for example, vacation photos are all in the format DSC00001.jpg to DSC001234 and I want to change it to something like, say, Rome0001.jpg to Rome1234.jpg.

    How about this:
    Go to the folder of your files in that.  Create a text file, and open it (Windows should use Notepad, that very well).
    in the file type:
    Ren dsc*.jpg rome*.jpg
    Now, save the file as:
    renamethem.bat
    (Make sure you call it ".bat" and save it as a txt document, which will make a simpel file and not add a strange formatting)
    From there, just double-click this file and it renames all your pictures accordingly.
    :)

    Old timer

  • How to activate windows where the key code is how to make one without spending money that I just bought the computer used

    I don't know my key code or how locate it how can I get a code key that I have no credit or debit or money

    Hi John,.

    You can follow the steps in the link below to check if the operating system you are using is enabled or not.

    How to tell if Windows 7 is activated?

    http://Windows.Microsoft.com/en-in/Windows7/how-can-i-tell-if-Windows-7-is-activated

    The steps in the link will help you activate Windows 7, but you must have a product key. If you do not, you need to buy it.

    Activate Windows 7 on this computer

    http://Windows.Microsoft.com/en-in/Windows7/activate-Windows-7-on-this-computer

    Do not hesitate to write to us in case if you have any questions. We will be happy to help you.

  • How to COPY a BACKUP as the... CONTROLFILE can be used for the OPEN database

    I create a document such as a "How To" to move a position for a Junior DBA controlfile.

    But it seems that I'm the Junior because I am facing the following...

    Action plan:

    Move/rename a Controlfile

    Version of the database: 11.2.0.3

    Controlfiles moving of:

    / goldengate/ORCL/ORADATA /.

    TO:

    / GoldenGate/ORCL/controlfile

    Step 1: Set up environment variables

    $> export ORACLE_SID = ORCL1

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    $> echo $ORACLE_SID

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ORCL1

    $> export ORACLE_BASE = / u01/app/oracle

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    $> echo $ORACLE_BASE

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    / u01/app/Oracle

    $> export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/dbhome_1

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    $ echo $ORACLE_HOME

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    /U01/app/Oracle/product/11.2.0.3/dbhome_1

    Step 2: Check control_files parameter

    $> echo "see THE PARAMETER control_files | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ------------------------------

    control_files string/goldengate/ORCL/ORADATA/control

    ol01. CTL, / goldengate/ORCL/ORA

    DATA/control02.ctl

    Step 3: Closing the open database

    $> echo 'SHUTDOWN IMMEDIATE'; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    The database is closed.

    The database is dismounted.

    ORACLE instance stops.

    Step 4: Editing of the database

    $> echo "STARTUP MOUNT"; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ORACLE instance started.

    Total System Global Area 4275781632 bytes

    Bytes of size 2235208 fixed

    822084792 variable size bytes

    3439329280 of database buffers bytes

    Redo buffers 12132352 bytes

    Mounted database.

    Step 5: Creating a copy of the current controlfile

    $> echo "AS BACKUP COPY CURRENT CONTROLFILE FORMAT ' / goldengate/ORCL/CONTROLFILE/control01.copy.ctl'; ' | RMAN target / nocatalog

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Recovery Manager: release 11.2.0.3.0 - Production Fri Oct 22 17:03:27 2015

    Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

    connected to target database: ORCL (DBID = 1420762587, is not open)

    using the control file of the target instead of recovery catalog database

    RMAN >

    From 22 October 15 backup

    allocated channel: ORA_DISK_1

    channel ORA_DISK_1: SID = 58 type of device = DISK

    channel ORA_DISK_1: from data file copy

    copy the current control file

    tag name=/goldengate/ORCL/CONTROLFILE/control01.copy.ctl output file = RECID = 1 STAMP = 893783011 TAG20151022T170329

    channel ORA_DISK_1: datafile copy complete, duration: 00:00:03

    Backup finished at 22 October 15

    RMAN >

    Complete recovery manager.

    Step 6: Change of parameter control_files

    $> echo "ALTER SYSTEM SET control_files='/goldengate/ORCL/CONTROLFILE/control01.copy.ctl' SCOPE = SPFILE;" | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Modified system.

    Step 7: Closing of the mounted database

    $> echo 'SHUTDOWN IMMEDIATE'; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ORA-01109: database is not open

    The database is dismounted.

    ORACLE instance stops.

    Step 8: Installation of the database

    $> echo "STARTUP MOUNT"; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ORACLE instance started.

    Total System Global Area 4275781632 bytes

    Bytes of size 2235208 fixed

    822084792 variable size bytes

    3439329280 of database buffers bytes

    Redo buffers 12132352 bytes

    Mounted database.

    Step 9: Check control_files parameter

    $> echo "see THE PARAMETER control_files | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ------------------------------

    control_files string/goldengate/ORCL/CONTROLFILE/c

    ontrol01. Copy.CTL

    Step 10: Open the mounted database

    $> echo "ALTER DATABASE OPEN"; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ALTER DATABASE OPEN

    *

    ERROR on line 1:

    ORA-01589: must use RESETLOGS or NORESETLOGS option of database open

    $> echo "ALTER DATABASE OPEN NORESETLOGS"; | sqlplus-s "virtue sysdba".

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ALTER DATABASE OPEN NORESETLOGS

    *

    ERROR on line 1:

    ORA-01610: recovery using BACKUP CONTROLFILE option must be

    Then...

    $> sqlplus/nolog

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    SQL * more: Production release 11.2.0.3.0 the game Oct 22 17:14:43 2015

    Copyright (c) 1982, 2011, Oracle.  All rights reserved.

    SQL > CONNECT sysdba virtue

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Connected.

    SQL > RECOVER DATABASE with the HELP of BACKUP CONTROLFILE until CANCEL;

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ORA-00279: change 621941 September at 22/10/2015 16:57:33 needed to screw 1

    ORA-00289: suggestion:

    /U01/app/Oracle/product/11.2.0.3/dbhome_1/DBS/arch1_11_892981851.dbf

    ORA-00280: change 621941 thread 1 is in sequence #11

    Specify the log: {< RET > = suggested |} Filename | AUTO | CANCEL}

    Cancel

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Cancelled media recovery.

    SQL > ALTER DATABASE OPEN;

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ALTER DATABASE OPEN

    *

    ERROR on line 1:

    ORA-01589: must use RESETLOGS or NORESETLOGS option of database open

    Issues related to the:

    What am I misunderstanding? BACKUP COPY THAT isn't really a COPY.

    Why I can't use the 'copy' of the controlfile created by RMAN?

    Note:

    If I just copy the controlfile to the new location when the database shuts down everything works fine.

    Thanks in advance.

    Juan M


    Recovery Manager (RMAN)

    It is also mentioned in https://docs.oracle.com/cd/E11882_01/server.112/e25494/control.htm#ADMIN11288

    Create additional Copies, rename and move the control files

  • How do I get my printer so that I stop my neighbors to use my wireless printer to print?

    I am on a wireless secured with 5 other apartments and a person has been recently able to access and print from my wireless printer. On the printer itself, I can't find where I put a code encryption or security of the printer. So, I hope that someone could walk me through how to set up so that the printer is secure. It's a HP Officejet 6500.

    In fact, it's quite possible. Simply adjust the security settings on the printer to do this. Just for printers and devices, right click on the unit, open the properties of the printer and on the 'Security' tab, you can restrict users on the same network.

    This should allow you to control your printer with a little more discretion.

    Happy holidays!

  • Find a specific PDF file between sheets of link using DW?

    Have a question from Dreamweaver/link. We map in PDF format in our library. I am trying to track down a specific PDF file of our binding sheets (check it's there). Is there a way to do more looking at the code in the sheet of each link file in Dreamweaver?... maybe indexed somehow, then the search index?

    The simple way to do this is to open search and replace (on the edit or Ctrl + F / Cmd + F).

    Use the following settings:

    • Find: all of the current Local Site
    • Search: Source Code
    • Search: the name of the PDF file

    Click Find all.

    The results will be displayed in a panel at the bottom of the screen.

  • Windows 7 x 64 envy 700-109cb - don't miss you that 2 drivers

    This forum is fantastic!  Thank you HP Experts!  I was able to install W7 and locate most of the drivers for this card mother IPM87-MP.

    Could you please help to locate the 2 drivers I'm missing?

    Network controller

    The drivers for this device are not installed. (Code 28)

    PCI\VEN_14E4 & DEV_43B1 & SUBSYS_2154103C & REV_03
    PCI\VEN_14E4 & DEV_43B1 & SUBSYS_2154103C
    PCI\VEN_14E4 & DEV_43B1 & CC_028000
    PCI\VEN_14E4 & DEV_43B1 & CC_0280

    BCM20702A0

    The drivers for this device are not installed. (Code 28)

    USB\VID_0A5C & PID_21FB & REV_0112
    USB\VID_0A5C & PID_21FB

    Thanks in advance for any help you can give.

    Doug

    I'm starting to lose hope on this one.

    I'll pull out all the stops here and go to other websites of PC support.

    Try this Bluetooth driver for laptop Lenovo.

    http://support.Lenovo.com/en_US/downloads/detail.page?docid=DS029104

  • How can I retrieve the e-mails that have been deleted? I use vista. and are on bell sympatico.

    the system I use is vista. the internet is bell sympatico.

    Does that mean that you are using Windows Mail, which is the e-mail provided in Windows Vista program or you are using an e-mail program provided by your service provider Internet, Bell?

    If it is Windows Mail, try this: http://www.ehow.com/how_5984806_recover-e_mails-windows-mail-vista.html

  • How can I disable the Outlook plugins that are installed with Acrobat DC using Acrobat Customization Wizard DC?

    I can't for the life of find me where the setting is to disable the Outlook plugins.  More precisely, it must disable sending and the track that appears on the Ribbon home Outlook after installation.

    In the features Panel.

  • How to package a different content, so that the same license can be used for all content.

    1) If packing everything at the same time, use the same DRMParameters instance whenever you call MediaEncrypter.encryptContent ().  Everything packed using the exact the same DRMParameters object will be associated with the same license.

    2) If the contents of package at different times, but who want to have all the content associated with the same license, you must use V2KeyParameters.setContentEncryptionKey ().  The first time you compress a piece of content, you would use ContentEncryptionKey.generate () to generate a new key/license ID.  To use the same key/license for the content later, you need to store the info in ContentEncryptionKey, so you can later pass in values for the new content.

    The content of the package at different times using the same license, you must implement the following:

    1. Call ContentEncryptionKey.generate to generate a new key and who deliver the ID.
    2. On your V2KeyParameters, call setContentEncryptionKey and pass the object generated in step 1.
    3. Call MediaEncrypter.encryptContent and pass in the V2KeyParameters (via DRMParameters), as usual.
    4. Store the contents of ContentEncryptionKey, values can be used later.  The key, license ID, and the date of packaging must all be stored.
    5. When you want content extra package using this license, looks for the stored key, license ID and packaging date and pass in the ContentEncryptionKey constructor to create an instance of ContentEncryptionKey.
    6. On your V2KeyParameters, call setContentEncryptionKey and pass the object generated in step 5.
    7. Call MediaEncrypter.encryptContent and pass in the V2KeyParameters (via DRMParameters), as usual.

    Media conditioned to steps 3 and 7 should now be protected using the same license.

  • Cannot create a daily backups from a batch file

    xcopy & too many parameters.

    I'm trying to create a simple daily to the top of a batch file.

    I am using the command line is:
    xcopy Files\Soredex\DfW2.1s\Image g:\Image/s/d c:\Program
    I get an error too many parameters. Can someone tell me what I am doing wrong?

    Put quotation marks around the file name with spaces included, so:

    xcopy "c:\Program Files\Soredex\DfW2.1s\Image" g:\Image/s/d

    I would also put a space before the second pass, but I don't know if it's absolutely necessary: / s/d

  • How to copy and paste from Thunderbird.

    Hello

    I know that this may seem obvious, but my question is not how to copy / paste because I know that orders.

    The problem is that whenever I have copy and paste all the texts that it sticks adds an extra space in it, so I need to go and remove the space, so it would be normal and not double spacing.

    I tried searching all possible options, but could not find any way for texts get pasted correctly.

    Any help would be appreciated!

    Open Tools/Options/Advanced/general/Config. Editor and double-click the preference layout.word_select.eat_space_to_next_word to activate it false.

    http://KB.mozillazine.org/layout.word_select.eat_space_to_next_word

    Same thing for Firefox, if you wish.

  • Give permission to the domain users to replace the file in the folder created by domain admin

    We have a domain controller in our network. also we have the domain users and domain administrator. We create a batch file that copies a file to the folder by using a script to the server policy when users open a session input/output. However if the admin area access system cant use overwrite file in the folder. We want to give permission to the domain users to replace the file in the folder created by the domain administrator.

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en/category/w7itpro, w8itpro, windowsvistaitpro, windowsxpitpro, windowsintune

    Hope the information is useful.

  • Access to folders and files on your computer using the UNC path in another area

    We have two different fields in our society (let's say the domain A and domain B)

    and are under the same subnet. Since some colleagues need to access the files in both sides,

    What we had planned is to their PC to join A domain and create a user account in domain B.

    When they need to access domain B to domain A PC files, they simply type in the unc path and

    Enter the credentials of their domain user account B.

    Now the situation is, when the user types in their identification of the B domain user account information, it always displays in Windows security:

    Connection failure: unknown username or bad password

    I wonder - is this due to the feature win CredSSP 7, as the CredSSP will affect Remote Desktop

    that cause similar unless problem shut down us by editing the default.rdp.

    Anyone know CredSSP is the cause of this problem? Or is it caused by another issue & no work around for it?

    Hello Frederik,

    I have already made to precede the user name with the domain name but always this error.

    Why I think that it is related to CredSSP is because I got the same error when I use

    remote control for PC B of the domain A PC. While the issue of distance is resolved by changing

    default.RDP with notepad, adding, [enablecredsspsupport:i:0] at the end.

    So, I wonder the problem of file also caused by CredSSP.

  • How can batch files - I copy files from subfolders

    II have a directory with several folders that contain pictures, documents, etc... I need a batch file which will look through all these aand only copy files .doc to a specific folder. Now there are hundreds of these files that need to be addressed through, so I really don't want og manually, would be nice if someone could help me here

    Duplicate file names... If you assume that there is not

    -> These assumptions are generally bad.

    is it easy to code?

    -> Easy to code but hard to understand, unless you're an expert. Notice that the script fails when it encounters some "poison characters" such as brackets or double quotes. If you have one of these in your file names or folder, then a different approach is required.

    off @echo
    Set SourceFolder = C:\Users\JohnDoe
    Define TargetFolder = D:\MyDocs
    for /F "delims =" % in ('dir /s /b /ad "% SourceFolder%\*.*" ') do)
    If there are some "%%a\*.doc" xcopy.exe/y "%%a\*.doc*" "% TargetFolder%\". »
    )

Maybe you are looking for