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 - Please help with folder search and copy script

Reply
 
Old 12-03-2008   #1 (permalink)
Thomas Niemann


 
 

Please help with folder search and copy script

Hi VBS-Grouü,

i have to find a sollution for the following, but i am afraid that this task
is too hard for me as a vbs newbie...

There is a folder which contains files like "12345678_BlaBla.doc".
Or Folder\Subfolder\12345678_BlaBla.doc

There is an additional destination folder-structure like this:

FolderName1\12345678\serverdocuments.doc
FolderName1\45642354\serverdocuments.doc
FolderName2\12345678\serverdocuments.doc
FolderName3\43233242\serverdocuments.doc

What i have to do is to go throu a path (Structure), dake the first 8
letters/numers of the filenames, search for folders with the same name as
the 8letters/numbers part of the filename, and copy the file in each folder
that matches.


Thank you all in advance

Kind Regards

Thomas



My System SpecsSystem Spec
Old 12-03-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Please help with folder search and copy script


"Thomas Niemann" <niemann.thomas@xxxxxx> wrote in message
news:4936696d$0$31343$9b4e6d93@xxxxxx-online.net...
Quote:

> Hi VBS-Grouü,
>
> i have to find a sollution for the following, but i am afraid that this
> task is too hard for me as a vbs newbie...
>
> There is a folder which contains files like "12345678_BlaBla.doc".
> Or Folder\Subfolder\12345678_BlaBla.doc
>
> There is an additional destination folder-structure like this:
>
> FolderName1\12345678\serverdocuments.doc
> FolderName1\45642354\serverdocuments.doc
> FolderName2\12345678\serverdocuments.doc
> FolderName3\43233242\serverdocuments.doc
>
> What i have to do is to go throu a path (Structure), dake the first 8
> letters/numers of the filenames, search for folders with the same name as
> the 8letters/numbers part of the filename, and copy the file in each
> folder that matches.
>
>
> Thank you all in advance
>
> Kind Regards
>
> Thomas
The first 8 characters of "12345678_BlaBla.doc" match two folders:
- FolderName1\12345678\serverdocuments.doc
- FolderName2\12345678\serverdocuments.doc
Are you saying that you wish to copy this file to both folders? What if the
file already exists in one or the other target folder?

Also: While the name "serverdocuments.doc" is permissible for a folder name,
it is rather unusual to give a folder a ".doc" extension. Is this really
what you mean?

Lastly: Does it matter if your source file resides in "C:\Folder" or in
"C:\Folder\Subfolder"? In other words, is the file supposed to be copied to
the same target folder, regardless of its source folder?


My System SpecsSystem Spec
Old 12-03-2008   #3 (permalink)
Thomas Niemann


 
 

Re: Please help with folder search and copy script

> The first 8 characters of "12345678_BlaBla.doc" match two folders:
Quote:

> - FolderName1\12345678\serverdocuments.doc
> - FolderName2\12345678\serverdocuments.doc
> Are you saying that you wish to copy this file to both folders? What if
> the file already exists in one or the other target folder?
Yes, i have to copy the file in each folder containing the first 8
letters/numbers of the files name.
Quote:

> Also: While the name "serverdocuments.doc" is permissible for a folder
> name, it is rather unusual to give a folder a ".doc" extension. Is this
> really what you mean?
No, there are not folders like the whole filename with extension.
Quote:

> Lastly: Does it matter if your source file resides in "C:\Folder" or in
> "C:\Folder\Subfolder"? In other words, is the file supposed to be copied
> to the same target folder, regardless of its source folder?
I have to go one by one file in the souce folder, and check for each file if
there are folders in the destination structure containing the first 8
letters/numbers and copy/move it into it


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Context Menu - Add COPY TO FOLDER and MOVE TO FOLDER Tutorials
please help with folder search and copy VB Script
Copy User Profile with VBS Script problem General Discussion
Re: VB Script Code to get alert when a folder get changed in intranet FTP Folder VB Script
Re: Copying CD files to folder, then copy folder to another hard drive, explorer hangs Vista file management


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