Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to exlude some extensions to a xcopy in bat

Posted on 2015-02-04
6
Medium Priority
?
113 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 …
Simple Linear Regression

705 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