?
Solved

Search and copy all files with a particular ext

Posted on 2007-07-24
2
Medium Priority
?
260 Views
Last Modified: 2010-03-05
Hi,

I want a script to copy any type of file ext i specify.
like "jpeg" search for jpeg file in all the drives in the machine and copy any files found to the path specified.

Regards
Sharath
0
Comment
Question by:bsharath
2 Comments
 
LVL 1

Expert Comment

by:biggstrc
ID: 19560078
I don't have a script, but a quick solution would be to use a file-copy program like Karen's Replicator (http://www.karenware.com/powertools/ptreplicator.asp).  You can set a filter on a job so that it only selects the file types you want.  The downside with Karen's is that it will create a directory tree that replicates what is on the source drive.  If this is a problem, I would look for another program like this one to do the job.  If you are a VB programmer, you could use the source code for Karen's to modify it to your needs.
0
 
LVL 14

Accepted Solution

by:
canali earned 2000 total points
ID: 19570373
Hoping nothing go wrong wmic command...

@echo off
setlocal
:: *** remove REM if u don't want output
REM set NoOUTPUT=^>nul 2^>^&1

::Creation of destination folder
%NoOUTPUT% mkdir c:\temp
%NoOUTPUT% mkdir c:\temp\img
:: ***set the destination folder
set copyTO=c:\temp\img

:: *** Looking For
:: change or add new exts
set lookFOR=*.jpg *.gif *.png *.bmp *.psd
for /f %%c in ('type c:\computers.txt') do (
  ((ping -n 2 -w 500 %%c|find /i "TTL" 1>null )&&  call :_FFinPC %%c  2>nul)||echo %%c: switched off
)
goto :_END
:_FFinPC
 set d=
 for /f "skip=1 delims=:" %%h in ('WMIC.EXE /Node:"%1"  path win32_LogicalDisk where drivetype^="3" get caption') do (
 set d=%%h
 call :_look4in \\%1\%%h$
)
goto :_EOF
:_look4in
echo look in %1 for %lookFOR%
echo for /r "%1" %%F in (%lookFOR%) do
for /r "%1" %%F in (%lookFOR%) do  (
  %NoOUTPUT% echo %%F
  %NoOUTPUT% copy "%%F" "%copyTO%"
)
goto :_EOF
:_END
:_EOF
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Some time ago I faced the need to use a uniform folder structure that spanned across numerous sites of an enterprise to be used as a common repository for the Software packages of the Configuration Manager 2007 infrastructure. Because the procedu…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Suggested Courses

621 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