Search and copy all files with a particular ext

Posted on 2007-07-24
Last Modified: 2010-03-05

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.

Question by:bsharath
    LVL 1

    Expert Comment

    I don't have a script, but a quick solution would be to use a file-copy program like Karen's Replicator (  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.
    LVL 14

    Accepted Solution

    Hoping nothing go wrong wmic command...

    @echo off
    :: *** 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
     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
    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

    Featured Post

    Don't lose your head updating email signatures!

    Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users should you!

    Join & Write a Comment

    Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
    INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
    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…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now