Re: file copier with log

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"krazymike" <krazymike@xxxxxxxxx> wrote in message
news:599d4797-31cf-4449-9726-b6ded48082a5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm writing a file copier where the user chooses the source directory
and the destination directory. I'm trying to preserve the file
structure, too. The dest is usually going to be a network path, so I
map a drive to it to avoid the MAX_PATH limit. I still have to re-map
this drive "on-the-fly" because the source's path gets pretty long,
too.

My procedure is recursive "for each file in folder.files . . . and
for each fldr in folder.subfolders recall procedure."

A colleague suggested that i map the source directory, too, and map
"on-the-fly." I think this would throw off my recursion. Also, I
need to log in an .mdb the source path, destination path, drive
mapping paths, and a verification that the copy was successful. I
have the logging part done and the destination mapping (not shown), i
just need help with the source mapping not throwing off my recursion.

Sub main()
Set rs = CurrentDb.OpenRecordset("Filecopy")
i = 0
Set fso = New FileSystemObject
Set srcF = fso.GetFolder(Prod_Path)
Set destF = fso.GetFolder(Prod_Path)
Call xerox(srcF)
End Sub

Sub xerox(f As folder)
Dim x As File, y As folder
For Each x In f.Files
i = i + 1
filecopier(x, f)
Next
For Each y In f.SubFolders
Call xerox(y)
Next
End Sub

Seeing that this particular wheel has been inventend and fully
optimised a long time ago at the Command Line level, I would
use the Run method of the WScript.Shell object to invoke
xcopy.exe or robocopy.exe. It handles all the recursive stuff
fully automatically and requires just one single line of code, e.g.

robocopy /s "d:\User Files" "\\TargetServer\Share\Folder" *.*

It even has inbuilt error handling routines.

BTW, what do you mean with " I'm trying to preserve the file
structure, too"? I thought that if a process does not preserve
the file structure then it's not a copy process?


.



Relevant Pages

  • mapper - multiple loops to a single destination
    ... I am trying to find a way in the BizTalk 2004 mapper to do multiple ... certain child nodes - all to the same destination node group in the ... where a specific child node's value meets a condition, and then map one ... <B>Because the value of sibling node A is 'TheOne', ...
    (microsoft.public.biztalk.general)
  • Re: Message appearence in a Trasformation Shape
    ... destination and when the i click ok it will open the map, just like you make it a drag Trasform shape and you specify every thing in the Transform Shape in the orchesteration view ... Have you selected an existing map? ... corresponds with the maps source schemas type and/or destination ... Private blog: http://blog.eliasen.dk ...
    (microsoft.public.biztalk.general)
  • Re: maps...
    ... need to use multimap for destination. ... > You can see that the second map is simply the first map with the key, ... The underlying tree structure of the source is unrelated to the ... a class that keeps a pointer to the actual ...
    (comp.lang.cpp)
  • Re: Paging TomTom Navigator peeps
    ... >>> destination (assuming I can browse the map by directional buttons and ... Select 'Set as destination' ... Tyger Burning Bright ... Black with extra black bits ...
    (uk.rec.motorcycles)
  • Re: [PHP] php File upload
    ... destination ist /tmp and is fairly empty. ... filesystem cache. ... What about the destination directory? ...
    (php.general)