Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

help with simple batch file issue

  • 28-02-2016 2:18pm
    #1
    Registered Users, Registered Users 2 Posts: 3,220 ✭✭✭


    Hi,

    I'm trying to create a simple batch file for end users that will serach their entire c:\ and make a copy of all files with a specefic extension. These files will be copied to a folder created on their U:

    I was going to use Xcopy, but that is copying the folder structure too, which is unwanted.

    This is what I have:

    @echo off
    c:
    mkdir backup
    for /R "c:\" %%f in ("*.rsf") do copy "%%f" u:\backup\ >nul

    This works - copies over all .rsf file from the C to the U, however it also copies over all .rsft files - which I don't want.

    What should I adjust so only .rsf files are copied?
    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 3,220 ✭✭✭cojomo2


    think I figured it out:

    for: /r "c:\" %%f in (*.rsf) do if /i !%%~xf"==".rsf" copy "%%a" u:\backup\ >nul


  • Registered Users, Registered Users 2 Posts: 4,020 ✭✭✭Hijpo


    cojomo2 wrote: »
    think I figured it out:

    for: /r "c:\" %%f in (*.rsf) do if /i !%%~xf"==".rsf" copy "%%a" u:\backup\ >nul

    What about robocopy??


  • Registered Users, Registered Users 2 Posts: 3,220 ✭✭✭cojomo2


    Hijpo wrote: »
    What about robocopy??
    doesn't robocopy copy directory structures also?


  • Registered Users, Registered Users 2 Posts: 36,170 ✭✭✭✭ED E


    cojomo2 wrote: »
    doesn't robocopy copy directory structures also?

    Robocopy has plenty of arguments, I'm pretty sure you can flatten output.


Advertisement