Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to exlude some extensions to a xcopy in bat

Posted on 2015-02-04
6
Medium Priority
?
124 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:Ernesto
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:Ernesto
ID: 40590348
Pelase put it in my bat
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 85

Accepted Solution

by:
oBdA earned 2000 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:Ernesto
ID: 40592063
exclude do not acept *.hlutubte

error
cant read *.hlutubte
regards
0
 

Author Closing Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Make the most of your online learning experience.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Progress

876 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