Solved

how to exlude some extensions to a xcopy in bat

Posted on 2015-02-04
6
91 Views
Last Modified: 2015-02-10
Hi i have a bat that put me all the new files to an external 2 TB usb disk

i been infected by ranscrypto and i want to exclude of my backup the  .HLUTBTE extension

is any way to achive that in my .bat file


my bat file is like

echo on
xcopy d:\  H:\  /s /e /D /Y /C

tsm you experts

regards edo
0
Comment
Question by:edo60
6 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 40590120
All you need to do is add the /EXCLUDE switch, like below...
echo on
 xcopy d:\  H:\  /s /e /D /Y /C /EXCLUDE:.HLUTBTE

Open in new window


Below is the exact help from xcopy /?
/EXCLUDE:file1[+file2][+file3]...
             Specifies a list of files containing strings.  Each string
             should be in a separate line in the files.  When any of the
             strings match any part of the absolute path of the file to be
             copied, that file will be excluded from being copied.  For
             example, specifying a string like \obj\ or .obj will exclude
             all files underneath the directory obj or all files with the
             .obj extension respectively.

Will.
0
 
LVL 3

Expert Comment

by:Rezwan Islam
ID: 40590126
Will is right but however I couldn't make it work this way. So I used a text file with all the extensions that needed to be excluded and used the EXCLUDE flag like this instead;

/EXCLUDE:Drive:\exclusionFileName.txt
0
 

Author Comment

by:edo60
ID: 40590348
Pelase put it in my bat
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 40590476
I'd use robocopy for that (assuming you're running Vista or later):
robocopy.exe D:\ H:\ *.* /xf *.HLUTBTE /e /r:0 /w:0

Open in new window

Note that robocopy will by default not copy files that already exist in the target folder with the same date and the same size; you'll find those under "skipped" in the summary at the end.
0
 

Author Comment

by:edo60
ID: 40592063
exclude do not acept *.hlutubte

error
cant read *.hlutubte
regards
0
 

Author Closing Comment

by:edo60
ID: 40601024
Tsm
regards!!!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question