Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Search c drive and copy files of a certain extension

Reply
 
Old 09-23-2008   #1 (permalink)
corvinus.is.alive


 
 

Search c drive and copy files of a certain extension

Hi Guys,

I need to be able to give users a script to run, that will search
their c drive, and copy all .doc, .xls, .ppt, .dot, .xlt, .mdb, .ost,
and .oft files to their H: drive

It will need to search c:, C:\Data, and C:\documents and settings\
%username%

Any Ideas?

My System SpecsSystem Spec
Old 09-23-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Search c drive and copy files of a certain extension


<corvinus.is.alive@xxxxxx> wrote in message
news:7bf38917-0dbd-4e67-b3c6-403a1d7ded12@xxxxxx
Quote:

> Hi Guys,
>
> I need to be able to give users a script to run, that will search
> their c drive, and copy all .doc, .xls, .ppt, .dot, .xlt, .mdb, .ost,
> and .oft files to their H: drive
>
> It will need to search c:, C:\Data, and C:\documents and settings\
> %username%
>
> Any Ideas?
The simplest method would rely on a one-line batch file like so:
@echo off
for %%a in (doc xls ppt dot xlt mdb ost oft) do xcopy /s /y /c /d
"%UserProfile%\*.%%a" H:\


My System SpecsSystem Spec
Old 09-23-2008   #3 (permalink)
mayayana


 
 

Re: Search c drive and copy files of a certain extension

See the FileSystemObject. GetFolder
returns a folder object, which has a subfolders
collection and a files collection. Eacg file in the
Files collection is an object with properties
such as path. There's also a CopyFile method.
Together, those methods will provide what
you need. It's all in the WSH help file.
Quote:

> I need to be able to give users a script to run, that will search
> their c drive, and copy all .doc, .xls, .ppt, .dot, .xlt, .mdb, .ost,
> and .oft files to their H: drive
>
> It will need to search c:, C:\Data, and C:\documents and settings\
> %username%
>
> Any Ideas?

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Certain files refuse to copy from C drive to USB drive Vista hardware & devices
Copy Files to GMail Drive PowerShell
Vista cannot search for text in files unless file extension is a manually added. Vista file management
Search hard drive for files containing ... ? Vista General
Vista drive has problem, want to copy files to new drive, HOW?? Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46