search and copy file with bat

May 8, 2010 at 02:12:21
Specs: Windows XP
I am looking for a batch file that will search the entire pc for jpg files and copy them on a usb stick. The batch programm should be on the usb and copy all jpg files of the pc on the usb-stick where the batch file is. If possible it would be perfect if the process would start with just one click an no tiping..
<<<<Thanks for every answer>>>>

See More: search and copy file with bat

Report •

May 8, 2010 at 06:59:56
@echo off & setLocal EnableDELAYedeXpansion

for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
if exist %%a:\ (
for /f "tokens=* delims= " %%d in ('dir/b/s/a-d %%a:\*.jpg 2^> nul') do (
copy "%%d"

Helping others achieve escape felicity


Report •

May 9, 2010 at 09:18:15
M2, I see 2 bugs with that:

- The target drive is amongst the list of (source) drives you are beholding. In the best case there will be a lot of erros shown, in the worst case, he'll stop
- If you have same named files on 2 different source drives (ex. C:\myjpg.jpg and D:\myjpg.jpg), at least one will be lost. I admit, chance is low

Report •

May 9, 2010 at 12:16:29
tvc can you write please the correct batch file? is it possible that this batch file runs just if it is on the pc and not on the usb-stick? because if i lunch it from a usb just a cmd(system32 or something) windows appears

Report •

Related Solutions

Ask Question