Re: Copying files in a certain date range to other locations



"aalaan" posted:
: Using vb5 I am trying to loop through a folder and select files
: within a certain date range and copy to another location. Can
: someone assist?

http://vbnet.mvps.org/?code/fileapi/copyfile.htm
http://vbnet.mvps.org/?code/shell/shfileopadv.htm
http://vbnet.mvps.org/?code/shell/shdirectorycopy.htm

Those links were found by typing the following into the Google
search textbox.

copy files site:vbnet.mvps.org

One of those should get you going in the right direction as far as
file copying goes. For the date time, I typed the following into
the Google search box...

file dates site:vbnet.mvps.org

http://vbnet.mvps.org/index.html?code/fileapi/filedatetime.htm

Randy Birch does such a great job with the code and the layout
at that site, that it ends up invaluable for many basic things, any
kind of file operations, many registry ops, and quite a few other
things as well.

With that said, I'll mention a couple extra things about file copying.

IF your moving files, rather than copying, it's always better to use
whatever "MOVE" mechanisms are available, rather than file copy
and then file delete. I'm going to date myself now (and I hope it
applies to NTFS as it did to FAT and FAT32 file systems), when
using one of the DOS MOVE commands, the command ends up
changing FAT pointers rather than actually moving the file and
moving ends up much faster than copying and deleting, and it
ends up as a safer way to do things with one exception... as long
as your moving files from one folder to another on the same
drive partition. Once you go to another partition or another drive,
the move command behaves like a copy and delete and copy
and delete can be better choices in those cases.

If your copying files through a batch file, xcopy works better
than copy. Also you want to use the xcopy command with the
/v switch applied, as it adds some extra verification to help make
sure the files get copied properly.

You can use ShellExecute() and create a batch file to do mass
copies. I'm not sure if any of the links I provided above offer
a verification switch to verify the files get copied properly, so
you'll want to look for that if no one else posts anything here.

Happy holidays.

--
Jim Carlock
Post replies to the group.


.



Relevant Pages

  • Re: Copying files in a certain date range to other locations
    ... Happy Holiday to you to. ... I'll mention a couple extra things about file copying. ... IF your moving files, rather than copying, it's always better to use ... the move command behaves like a copy and delete and copy ...
    (microsoft.public.vb.general.discussion)
  • Re: How to copy whole folders?
    ... and the destination folder to have the same name as a source folder ... I do not want xcopy to supress the error. ... and restart the same xcopy command until all files are copied. ... Windows continue copying files but not quitting copying process as it is ...
    (microsoft.public.windows.file_system)
  • Re: How to copy whole folders?
    ... local folder as a source ... I do not want xcopy to supress the error. ... and restart the same xcopy command until all files are copied. ... Windows continue copying files but not quitting copying process as it is ...
    (microsoft.public.windows.file_system)
  • Re: Does "Move File" also update registry?
    ... the Move command doesn't move the data at all ... unless the move is from one storage device to another. ... When you move a file from one folder to another on the same storage ... I was thinking of moving files from one physical disk to ...
    (microsoft.public.windowsxp.general)
  • Re: Question from an eejit - backing up data
    ... I do this by copying "My Documents" folder in Windows ... then it stops the copying operation entirely. ... Can I achieve this by loading a Command Prompt and using ...
    (microsoft.public.windowsxp.basics)