Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Is it possible to .....  (Read 3629 times)

0 Members and 1 Guest are viewing this topic.

plnick240

  • Guest
Is it possible to .....
« on: May 09, 2006, 02:56:59 PM »
Hello  ;D

I am new to this form, so I hope I am doing this right.

I just need to know if it is possible to search a folder and all its subfolders for a type of file (like .pdf, .exe, etc...), and then copy them to another folder, or drive.
Sorry, the OS I am using is Windows XP and it NEED to be in a batch file. So, if anybody can help me PLEASE reply.

ONE KEY THING is that I only want the files (like .pdf, .exe, etc...), not folders.
I have tried XCOPY

Thanks

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Is it possible to .....
« Reply #1 on: May 09, 2006, 04:11:12 PM »
Not really sure why you NEED batch with XP but hey, it's your call:

Code: [Select]
@echo off
for /f "delims=" %%v in ('dir /b /s c:\*.pdf') do copy %%v destdir
for /f "delims=" %%v in ('dir /b /s c:\*.exe') do copy %%v destdir

Change the path of the destdir to something meaningful. Also point the path of each file type to the correct directory.

You can add as many FOR statements as you need. XCOPY works also, but it's so d*** messy.

Good luck.  8-)
« Last Edit: May 09, 2006, 04:14:24 PM by Sidewinder »
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

plnick240

  • Guest
Re: Is it possible to .....
« Reply #2 on: May 09, 2006, 06:41:58 PM »
Thank you!

The whole reason I needed a batch because some people I work with don't know how to work a computer that well.

Nick