Journal Files Location

Journal Files Location

Dale.Bartlett
Collaborator Collaborator
1,622 Views
3 Replies
Message 1 of 4

Journal Files Location

Dale.Bartlett
Collaborator
Collaborator

Is this the only way to determine the location of Journal files?

Application.RecordingJournalFilename

 

The intention is to run a cleanup tool outside of Revit, so I've checked the registry and Revit.ini but can't find any reference. Thanks. Dale  




______________
Yes, I'm Satoshi.
0 Likes
Accepted solutions (1)
1,623 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Dale,

 

Thank you for your query.

 

There is always more than one way to do everything.

 

I always believed that Revit always places journal files in the journal subdirectory under the main Revit folder containing Revit.exe itself.

 

You could also search your hard disk for files whose names match the standard Revit journal file naming convention, and even parse their content to verify that they really are Revit journal files, not just by name, but also by content.

 

However, I assume that using the RecordingJournalFilename property is the only official way to go, and also the safest and most convenient.

 

You could always store the property value somewhere in the system.

 

You could also check and compare the property with the stored value every time Revit is started up and issue a warning and/or update your external data if it is modified.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

Dale.Bartlett
Collaborator
Collaborator

Hi Jeremy, Thanks again for the reply. The Journal folder is actually here now:

C:\Users\<USER>\AppData\Local\Autodesk\Revit\Autodesk Revit 2017\Journals

It seems the location is written into the code, as it is recreated if moved/deleted. I'll use Application.RecordingJournalFilename.

Thanks, Dale 




______________
Yes, I'm Satoshi.
Message 4 of 4

Dale.Bartlett
Collaborator
Collaborator
Accepted solution

This is what I came up with, in case someone finds it useful (or improves it):

private void GetJournalFolders()
        {      
            string lstrPathWithEnv = @"%USERPROFILE%\AppData\Local\Autodesk\Revit";
            string lstrRootFolder = Environment.ExpandEnvironmentVariables(lstrPathWithEnv);
            string[] lstrFoldersFound = Directory.GetDirectories(lstrRootFolder, "Journals", SearchOption.AllDirectories);

            Int32 lintFileCount = 0;
            Int64 lintTotalSize = 0;
            string lstrMsg = string.Empty;

            foreach (string lstrFolder in lstrFoldersFound)
            {
                lintTotalSize = GetFolderSize(lstrFolder, out lintFileCount);
                double ldblTotalSizeMB = ((double)lintTotalSize / 1024) / 1024;

                if (lstrMsg == string.Empty)
                    lstrMsg = "Journal files found:";

                lstrMsg = lstrMsg
                        + Environment.NewLine
                        + Environment.NewLine
                        + lstrFolder
                        + Environment.NewLine
                        + "Total Files: "
                        + lintFileCount.ToString()
                        + Environment.NewLine
                        + "Total Folder Size: "
                        + ldblTotalSizeMB.ToString("0.##")
                        + " MB ("
                        + lintTotalSize.ToString("#,##0")
                        + " bytes)"
                        ;
            }
            MessageBox.Show(lstrMsg);
        }



______________
Yes, I'm Satoshi.
0 Likes