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 - coping jpg files from computer help

Reply
 
Old 06-18-2009   #1 (permalink)


Vista Home Premium 32bit
 
 

coping jpg files from computer help

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

My System SpecsSystem Spec
Old 06-18-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: coping jpg files from computer help


"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
>
>
> --
> keeping
Is your aim to just copy the files (in which case a batch file would be a
quick and easy solution) or to learn about VB Scripting (in which case I
recommend that you download the help file script56.chm from the Microsoft
site). This file contains all the basic VB Script functions and methods,
complete with examples.


My System SpecsSystem Spec
Old 06-18-2009   #3 (permalink)
Joe Fawcett


 
 

Re: coping jpg files from computer help


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:uUDbIXA8JHA.2656@xxxxxx
Quote:

>
> "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
>>
>>
>> --
>> keeping
>
> Is your aim to just copy the files (in which case a batch file would be a
> quick and easy solution) or to learn about VB Scripting (in which case I
> recommend that you download the help file script56.chm from the Microsoft
> site). This file contains all the basic VB Script functions and methods,
> complete with examples.
>
Specifically look at FileSystemObject and GetFolder together with the
SubFolder and the Files collections.
Remember to exclude the folder you are copying to from the search or things
may go pear shaped

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

My System SpecsSystem Spec
Old 06-18-2009   #4 (permalink)
Al Dunbar


 
 

Re: coping jpg files from computer help


"Joe Fawcett" <joefawcett@xxxxxx> wrote in message
news:uI$pDzA8JHA.1380@xxxxxx
Quote:

>
> "Pegasus [MVP]" <news@xxxxxx> wrote in message
> news:uUDbIXA8JHA.2656@xxxxxx
Quote:

>>
>> "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
>>>
>>>
>>> --
>>> keeping
>>
>> Is your aim to just copy the files (in which case a batch file would be a
>> quick and easy solution) or to learn about VB Scripting (in which case I
>> recommend that you download the help file script56.chm from the Microsoft
>> site). This file contains all the basic VB Script functions and methods,
>> complete with examples.
>>
>
> Specifically look at FileSystemObject and GetFolder together with the
> SubFolder and the Files collections.
> Remember to exclude the folder you are copying to from the search or
> things may go pear shaped
Also remember that some of the files your script finds in different folders
may have identical names. You will need to either rename these so they do
not conflict, or place them in different folders on the USB drive.

/Al


My System SpecsSystem Spec
Old 06-18-2009   #5 (permalink)
mayayana


 
 

Re: coping jpg files from computer help

There are some similar scripts here that
you should be able to adapt:

www.jsware.net/jsware/scripts.php5#recur

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
>
>
> --
> keeping

My System SpecsSystem Spec
Old 06-18-2009   #6 (permalink)
Paul Randall


 
 

Re: coping jpg files from computer help


"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


My System SpecsSystem Spec
Old 06-18-2009   #7 (permalink)
mayayana


 
 

Re: coping jpg files from computer help

Quote:

> 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
Quote:

> the search window.
Not such a good idea. The Shell.App Folder
object represents an Explorer window, not the
file system. It can't be depended upon to
return all files in a folder. Much better to use
FSO.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Coping whole HD's without cloning. Vista file management
Coping Email Vista General
Can't view shared files on XP computer from Vista Home Premium computer Vista networking & sharing
How to setup Username/Password for a drive in a Windows XP computer to backup files from a Vista computer? Vista General
Can only access Public Files on Vista computer from XP computer Vista networking & sharing


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