Friday 31 May 2019

windows - How can I get the "dir" and "copy" commands to operate on "*.xyz" but not "*.xyz~"?


When I use copy *.txt somefolder\ the system seems to copy all *.txt~ files too, which is not what I want. A similar same effect can be seen with dir:


C:\Users\Paul\Documents\Programs\Proffy>dir *.txt
Volume in drive C is Vista
Volume Serial Number is EC23-AD6B

Directory of C:\Users\Paul\Documents\Programs\Proffy

29/11/2008 13:54 35,821 COPYING.txt
31/10/2009 21:54 1,644 INSTRUCTIONS.txt
06/06/2009 15:57 1,393 INSTRUCTIONS.txt~
04/01/2009 11:59 116 Notes.txt
19/04/2009 16:53 134 README.txt
04/01/2009 12:42 132 README.txt~
31/10/2009 21:30 197 TODO.txt
31/10/2009 19:10 414 TODO.txt~
8 File(s) 39,851 bytes
0 Dir(s) 41,938,862,080 bytes free

C:\Users\Paul\Documents\Programs\Proffy>

How can I get dir and copy to only operate on files that end with .txt and not .txt~?



Answer



My solution was to execute del *.xyz~ prior to my copy *.xyz. Not brilliant, but it works.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...