For Programmers: Free Programming Magazines  


Home > Archive > VC Language > January 2006 > Moving files vs. copying









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Moving files vs. copying
Lilith

2006-01-25, 7:23 pm

A new project requires that I move files from one directory to another
in a controlled manner. In general I expect the two directories to be
on the same media (network) under most instances. But the program may
have some wider application outside of my needs and I can't guarantee
that others would follow my precautions. When the files are on the
same media the equivalent functionality of the DOS "move" command
would help in that speed is of the essence. I believe the approach is
to do some creative repointing with the FAT and directory entires. For
files on different media I can only see doing a copy.

Pure copying isn't beyond me but I'd rather not re-invent the horse if
it isn't necessary. Can anyone recommend some pointers to either or
both of these functionalities, or something that does both jobs.

I know this is more like an algorithm question but I'm hoping that
there's something available under VC++ that's handy.

Thanks,
Lilith
William DePalo [MVP VC++]

2006-01-25, 7:23 pm

"Lilith" <lilith@dcccd.edu> wrote in message
news:034gt1p0ji4qf21n2i8i335vvrn3aoo1s3@
4ax.com...
>A new project requires that I move files from one directory to another
> in a controlled manner. In general I expect the two directories to be
> on the same media (network) under most instances. But the program may
> have some wider application outside of my needs and I can't guarantee
> that others would follow my precautions. When the files are on the
> same media the equivalent functionality of the DOS "move" command
> would help in that speed is of the essence. I believe the approach is
> to do some creative repointing with the FAT and directory entires. For
> files on different media I can only see doing a copy.
>
> Pure copying isn't beyond me but I'd rather not re-invent the horse if
> it isn't necessary. Can anyone recommend some pointers to either or
> both of these functionalities, or something that does both jobs.
>
> I know this is more like an algorithm question but I'm hoping that
> there's something available under VC++ that's handy.


Yeah, there is.

Forget fiddling with the FAT. Call MoveFile() (e.g. it fails if you try to
move across drives). If it fails you call CopyFile(). If that fails report
the error.

Regards,
Will


Lilith

2006-01-25, 9:59 pm

On Wed, 25 Jan 2006 19:29:27 -0500, "William DePalo [MVP VC++]"
<willd.no.spam@mvps.org> wrote:

>"Lilith" <lilith@dcccd.edu> wrote in message
> news:034gt1p0ji4qf21n2i8i335vvrn3aoo1s3@
4ax.com...
>
>Yeah, there is.
>
>Forget fiddling with the FAT. Call MoveFile() (e.g. it fails if you try to
>move across drives). If it fails you call CopyFile(). If that fails report
>the error.


Many thanks. FAT fiddling wasn't on my list of things to tackle.

>Regards,
>Will


--
Lilith
Tom Serface

2006-01-26, 7:08 pm

You could also use:

http://msdn.microsoft.com/library/d...leoperation.asp

Tom

"Lilith" <lilith@dcccd.edu> wrote in message
news:034gt1p0ji4qf21n2i8i335vvrn3aoo1s3@
4ax.com...
>A new project requires that I move files from one directory to another
> in a controlled manner. In general I expect the two directories to be
> on the same media (network) under most instances. But the program may
> have some wider application outside of my needs and I can't guarantee
> that others would follow my precautions. When the files are on the
> same media the equivalent functionality of the DOS "move" command
> would help in that speed is of the essence. I believe the approach is
> to do some creative repointing with the FAT and directory entires. For
> files on different media I can only see doing a copy.
>
> Pure copying isn't beyond me but I'd rather not re-invent the horse if
> it isn't necessary. Can anyone recommend some pointers to either or
> both of these functionalities, or something that does both jobs.
>
> I know this is more like an algorithm question but I'm hoping that
> there's something available under VC++ that's handy.
>
> Thanks,
> Lilith



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com