Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy HD using VB

Status
Not open for further replies.

eman6

Programmer
Dec 7, 2004
578
0
0
CH
I have a Notebook with 40GB and have recently purchased a 80GB hard disk to replace the smaller one and keep it as external.
You can imagine I need to 'pour' everything 'as is' from the old into the new without need to re-install.
I thought there must be some simple VB code that can do the job, because it looks like Windows XP does not provide a means to transfer system files, does it.
I am not willing to purchase a utility to do that unless I really have to, simply because I will be using it most probably ONCE.

Thanks in advance for any advice.
 
The hard disk you bought should have a CD with it that has a utility on it for copying one hard drive to another directly. All the major brands I've worked with (Seagate, Western Digital, Maxtor) have those. If not, then a search for a disk copying utility on Google.com should get you something for free.

Lee
 
The hard disk I bought had no utility with it.
I also had a look at Maxtor, WD, Hitachi, Toshiba, etc and all have disks that help initialize your new HD, partition it and format it.
There's nothing for free that does the job I need.
Of course I looked on google.com too.
I would still like to see what I could do with VB, if possible at all.

Thanks
 
Download Data Lifeguard Tools 11 for Windows from Western Digital at this link It has a utility that does exactly what you want.

Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
As far as copying a hard drive across to another... It theoretically is posible in VB, BUT you would really want to get this type of program (which deals with LOW level system architecture, and lots of it...) made with a language such as VC++, which is optimized for speed and has more readily available access to the PC's inner structure...

VB is good for making Front Ends for these types of programs, but not for the working core of them...

If it is Possible to copy a Drive With XCopy, you might could use a shell command to invoke it...
(Why you would want to do this, as opposed to opening a command prompt and typing the same command, Is beyond me...)

Aside from that you would be better off using a program compiled under some type of C/C++ compiler...

You see alot of us in here Using APIs to do all types of non-standard-VB tasks, these API functions are written in C++ and are compiled to DLLs as ready to run code... Which is why we can get away with having wild task completing at the speed they do... If you were to find any API calls to complete this type of tasks it MIGHT work, yet you would still be Reinventing the wheel, and would still not run as fast as A C++ version... VB Loops are still relatively slow (when put into perspective against C++) and I'm sure the program would consist of many recursive loops...

After All... 40GB is a hella 1's & 0's ;-)

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Dr Java Joe
Thank you for the link to this utility.
Yes it looks like it has a copy function too, in addition to new installation facility.
I hope it is not WD specific though.

CubeE101
I have heard a lot of criticism in the past both from C++ and Java developers regarding VB.
I have learned VB by myself, starting from VB 1, with background from BASIC. I upgraded my knowledge with VB 2, 3, 4, 5, and finally 6. I find it wonderful user-friendly and easy.
In general, I never needed to develop big and complex projects which necessitate such languages as C++ and Java.
By the way, Java developers criticise C++ a lot.
I have the feeling sometimes that C developers wish there was no Windows so only computers specialists can use computers.
But anyway, I think you misunderstood a bit what I want to do.
XCopy does not transfer the hidden system files, and I do not need any low level formatting and partitioning. It's done already, using readily available Win XP tools.
Control Panel > Administrative Tools > Computer Management
then Storage > Disk Management.
Thanks anyway.
 
strongm
Thanks for the link.
I'll give it a try if WD did not work.
 
>> I have the feeling sometimes that C developers wish there was no Windows so only computers specialists can use computers.

heh, same here ;-)

>> XCopy does not transfer the hidden system files, and I do not need any low level formatting and partitioning. It's done already, using readily available Win XP tools.

Can VB transfer these files w/o the low level features? (I never tried...)

If you are looking for code to traverse through the directory structure, you can do that with the DIR() function...

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
> XCopy does not transfer the hidden system files

Um... /H
 
yup...

this is what you get when you type:
xcopy /?
(or... xcopy /?>xcopy.txt ;-))
Code:
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A           Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M           Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P           Prompts you before creating each destination file.
  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V           Verifies each new file.
  /W           Prompts you to press a key before copying.
  /C           Continues copying even if errors occur.
  /I           If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
  /Q           Does not display file names while copying.
  /F           Displays full source and destination file names while copying.
  /L           Displays files that would be copied.
  /G           Allows the copying of encrypted files to destination that does
               not support encryption.
  [b]/H           Copies hidden and system files also.[/b]
  /R           Overwrites read-only files.
  /T           Creates directory structure, but does not copy files. Does not
               include empty directories or subdirectories. /T /E includes
               empty directories and subdirectories.
  /U           Copies only files that already exist in destination.
  /K           Copies attributes. Normal Xcopy will reset read-only attributes.
  /N           Copies using the generated short names.
  /O           Copies file ownership and ACL information.
  /X           Copies file audit settings (implies /O).
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
I hope it is not WD specific though.

It's not, I've been using WD Life Guard tools for years and it works on all IDE drives.

Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
OK Gentlemen
I have performed the copy operation using the WD utility.
At the end, it shows that 12 out of ???????? files could not be copied.
It gave the list. Some of these files are system files, others are pagefile and hibernate stuff. The rest is unimportant.
It also says, these files are important for the operating system, but that in most cases it recreates them.
Now is the time that I exchange the two HDs and see if the copy did what I hoped it to do. I'll let you know.

Thanks
 
Latest developments
I tried the WD utility. They have an option to start with a new hard drive and make it the bootable one, yes exactly what I wanted to do...
Well, it did not succeed :-(
As I swapped the HDs, it stayed in lala land, not prompting anything, but not booting.
I also tried xcopy with the options /h /k /o /c

I'll download the Maxtor one and try it.

Till then.
 
Maxtor says (about MaxBlast 3):

Note: There must be at least one Maxtor ATA Disk Drive installed in the system for MaxBlast 3 to run.

My original is Hitachi, and the new is Samsung.

Any suggestions?
 
Click Here to see the proper instruction for using the Western Digital software. I've used it many times, though I usually use the Dos version.


Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Have you used it for a notebook with a USB connection?
 
how about...
xcopy C:\*.* X:\ /E /C /I /F /G /H /K /X /Y

where X:\ is the drive to copy too...

(/X includes /C)
>>/X Copies file audit settings (implies /O).

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
The Maxtor MaxBlast 3 is EXACTLY the same utility Western Digital uses. The only difference is that it is labeled MAXTOR rather than WD.

Now xcopy suggestion. Why would anybody bother to produce software to do a job xcopy can do?????

I'm really losing hope after all this. I guess I'll try to find something in my VB manuals.
 
Cannot say that I have, but cannot see why it wouldn't work.

Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top