Skip to main content

Apending Multiple Files In IDEA

Hi All
I have just imported 2000 files into IDEA. Is there an easier way to append all at one go? Is there possibility of writing a custom script? I am using IDEA 8.5.
Thank you in advance.
Regards
Aveen
 
 

Brian Element Wed, 12/04/2013 - 18:23

Aveen, here is a script that will do it, it is pretty much the same script as the import.  The FOLDER shows the location of the imd files you want to append together.  I would recommend having them in a directory one level under your working folder.  This will read through all the files in that directory and append them together.

 


Option Explicit
Const FOLDER = "C:\Users\Brian\Documents\My IDEA Documents\IDEA Projects\Samples\aveen test\"
Const EXTENSION = "*.IMD"
Dim workingFolder As String
Sub Main 
	workingFolder =Client.WorkingDirectory() 
	Call importFiles()
	client.refreshFileExplorer
End Sub
Function importFiles() 
	Dim Files As String 
	Dim filename As String 
	Dim dbName As String 
	Dim db As database
	Dim task As task
	Files = Dir(FOLDER & EXTENSION) 
	Dim bFirstPassInd As Boolean  
	bFirstPassInd = true 
	Set db = Client.OpenDatabase(FOLDER & Files)
	Set task = db.AppendDatabase
	Files = Dir 
	 Do  
	 	' Get the next file name and place it in FileList.  
	 	If Len(Files) > 1 Then  
	 		
	 		task.AddDatabase FOLDER & Files
	 	End If  
	 	Files = Dir 
	 Loop While Files <> ""
	 dbName = client.uniquefilename("Append Databases")
	task.PerformTask dbName, ""
	Set task = Nothing
	Set db = Nothing
	Client.OpenDatabase(dbName)
	 Set db = Nothing
	 Set task = Nothing
End Function

Brian Element Thu, 02/20/2014 - 20:15

There are a couple of reasons for that suggestion.  This script performs an append of all the imd files located in that particular directory.  If you left it at the top level so either at the project folder or working folder level the script would try and append every imd file, more than likely you will have files in there that are not of the same type.  By placing all the files you wish to append one level lower you can isolate all the imd files that you wish to append together.  One of the limitations of the append is that all the files have to be located in the project or working folder, as IDEA allows one level below that, that is usually the best option for this type of script.

Hope that makes sense.

city1 Wed, 10/22/2014 - 00:10

This script is very useful. Is there a way to modify the script such that there is an interface for the user to select the FOLDER? Thank you.