Problem Solution Suggest article Fixit Knowledge Solutions

 

Solution

What is the copyfiles utility?

Sometimes, to speed up the archiving process, you may need to copy .msg files directly to the ASM queue folder [<ASM root>\engine\queue]

The 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 you 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: (assuming ASM is installed on the C drive)

1. Open the Windows command prompt
2. Type:
 cd\
 cd [ASM root]\tool
3. Type:
 copyfiles to display the correct syntax for the command
or
 copyfiles [/s] [] [-p ]

where

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

- If is an ASM repository that was previously compressed you don't need to specify anything else. Copyfiles and ASM automatically reads these kind of files.

- The time required for the tool to start copying files could be quite long because the process need to count all the files in the tree before proceeding.

- If you plan to import a huge number of files (> 100,000) it's better to split the process into multiple jobs, for example importing only one month for each command issued:

/2007/02
/2007/01
/2006/12
/2006/11
/2006/10
/2006/09
etc.

Below is an example of some VBscript kindly given by an ASM user 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:\ASM\engine\queue\" '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.

 

 

 Vote/comment on this solution
Was this Fixit article useful? (Ave 60%)  
Very poor Extremely useful  


 
Your email:  
Comments:  
  characters left  

 

 Solution information
Fixit ID: f24 
Created on: 17/10/2008
Last reviewed: 20/10/2008