Solved

how to exlude some extensions to a xcopy in bat

Posted on 2015-02-04
6
94 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
[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:edo60
ID: 40590348
Pelase put it in my bat
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

739 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