What is the copyfiles utility?

KB50807

Ultimo aggiornamento: 12 January 2012

Copyfiles utility

Sometimes, to speedup the archiving process, you need to copy .msg files directly to the ASM queue folder [enginequeue]

Copyfiles utility can be useful if:

– It's necessary to copy an entire IMAP folder (including its subfolders) into the queue.
– After an ASM reinstallation where the Database was corrupted
– if you are experiencing problems with ASM uploader or with IMAP importing.

This command line utility, contained in the folder of ASM root, allows to copy all the files with a certain extension from a folder tree (e.g. ASM repository) to a single destination folder like the ASM archiving queue folder.

To use it you need to: (considering ASM installed in C drive)

1. Open the Windows command prompt
2. Digit:
 cd
 cd "<ASM root>"tool
3. Digit:
 copyfiles to display the correct syntax for the command
or
 copyfiles [/s] <source folder> <destination folder> [<extension>] [-p <password>]
where

/s –> permits to copy the entire subfolder structure
<source folder> –> absoluth path of the source folder
<destination folder> –> absoluth path of the destination folder
<extension> –> only copy the files with the extension specified (without the ".", ex. msg)
-p <password> –> permits to specify a password if files had been previously encrypted (in case the source is ASM repository)

– If <source folder>is an ASM repository that was previosly compressed you don't need to specify anything else. Copyfiles and ASM automatically reads this kind of files.
– The time requested for the tool to start copying files could be quite long because the process need to count all the files of the tree before proceeding.
– If you plan to import a huge number of file (ex 100.000) it's better to split the process into multiple jobs, for example importing only one month for each command issued:

<old repository>/2007/02 <old repository>/2007/01 <old repository>/2006/12 <old repository>/2006/11 <old repository>/2006/10 <old repository>/2006/09
etc.

An ASM user kindly gave us this VBscript that you can use for this purpose (Achab does not guarantee the correct functioning)

######################
'feedASMqueue.vbs
'written by Simon Meggle
'Schedule this script to run every minute to feed the ASM queue
'######################

Dim var_source, var_dest
'adapt these paths
 var_source = "R:AS-Temp-Queue2" 'move files from the old repository into this temp path (copyfiles.exe /s

[old_repository_path] [temp_path]
 var_dest = "R:ASMenginequeue" 'this is the "hot" queue of the ASM installation

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim arrFiles()
Dim i
i = 0

Set myFolder = fso.GetFolder(var_source)
Set myFiles = myFolder.Files

For Each myfile In myFiles
'OK…. not professional, but it works
 ReDim preserve arrFiles(i)
 arrFiles(i) = myfile.Name
 i = i+1
Next

Dim sum_files
sum_files = myFiles.Count

'depending on mySQL performance, this is the amount of e-mails which should ASM queu feeded with every minute.

'Feed the queue manually with 100 emails and watch the system performance to get a feeling for the right amount of emails per minute.
If sum_files > 100 Then
 sum_files = 100
End If

For i = 0 To (sum_files – 1)
'copy all files except HIWATER.MRK
 If Not arrFiles(i) = "HIWATER.MRK" Then
  fso.MoveFile var_source & arrFiles(i), var_dest & arrFiles(i)
 End If
Next

Set myFolder = Nothing
Set myFiles = Nothing

'Importing ~40.000 e-mails took about 7-8 hours with a medium server load.