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



Thanks Jim. Happy Holiday to you to. There was something much much simpler
that someone showed me that used the Dir function/statement. I can get the
FileDate OK. It's just the syntax for looping through a given
directory/folder using Dir

"Jim Carlock" <anonymous@localhost> wrote in message
news:u93vOmKKHHA.2632@xxxxxxxxxxxxxxxxxxxxxxx
"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
    ... Using vb5 I am trying to loop through a folder and select files ... 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)
  • Setting multiple variables for one "set" command?
    ... various computers on the network. ... The batch file executes without a problem and copies the file over to ... The "file" variable wont have to change at all because we are copying ... like to change after every successful execution of the command. ...
    (microsoft.public.scripting.wsh)
  • Re: Need suggestion how to hide ugly black command prompt window
    ... then you dont have to deal with command windows period ... Set oExCmd = oShell.Exec ... ...what to do if copying a file succeded... ... The problem is with this ugly black command prompt that pops up. ...
    (microsoft.public.scripting.vbscript)
  • 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: File modification and opening dates
    ... Chris Ridd wrote: ... I suppose copying a file to another ... and I'm just about to go on holiday so I'll ... displaying. ...
    (comp.sys.mac.apps)