"keeping" <guest@xxxxxx-email.com> wrote in message
news:ff1036493a10cd0aff0407e83bc8d001@xxxxxx-gateway.com...
Quote:
>
> Hello All,
> I am very green with VBS, so i appologize in advance. I am trying to
> figure out how to write a VBS to scan a particular extension (i.e. *.jpg
> or *.doc) on my entire hard drive (C
including subfolders and copy
> them to a single folder on the computer or a USB drive. i want to be
> able to change the extension as needed or if it is possible be able to
> copy multiple extensions, also a completion message would be really
> nice. Hopefully this is possible.
> Thanks in advance You didn't state the operating system of the computer; if it is WXP, you
could manually open a search window and have it list all the .jpg files.
This search also can go at least one level deep into .zip and .cab
compressed files, which can be handy at times. You could then start your
..VBS file which would use the shell.application object to find the search
window, and from there drill down to the shell folder object that represents
the search window. This shell folder object has a folderItems property
which gives you a collection of all the items in the search window. The
script could then go through the collection and perhaps weed out duplicate
files based on file name, size, or file checksum (CRC-32 and/or SHA-1 with
Microsoft's command line tool fciv.exe). You might still have collisions -
files with identical names and with different contents, from different
original folders, and the script could count these and decide on an
appropriate number of folders to hold the duplicate file names. Once all
this is done, the script could copy the files one by one from their original
folders to the appropriate destination folder.
I think Vista's file search is too different from WXP's for this approach to
work on Vista, but it is possible that it can be done there too.
I am working on a similar project right now on WXP.
-Paul Randall