![](/img/trans.png)
[英]How to process only the most recent file in a directory using Mirth Connect?
[英]How can we read a config file stored at a location relative to the Mirth Connect Installation directory?
我們如何讀取相對於Mirth Connect安裝目錄的位置存儲的配置文件?
例如,如果Mirth安裝在/ opt / Mirth-Connect目錄中,而我想從/ opt / Mirth-Connect / conf目錄中讀取文件,而不指定完全限定的路徑名。
我們正在為安裝在同一台計算機上的不同環境使用Mirth的多個實例,因此我無法在通道配置中硬編碼完整路徑。
您可以按照與讀取任何其他文件相同的方式來讀取存儲在相對於Mirth Connect安裝目錄的位置的配置文件,即:
var folder = new java.io.File("./conf");
var listOfFiles = folder.listFiles();
for (var i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
// Do what you need with the file - listOfFiles[i].getName());
}
}
第一行為您提供相對於mcserver.exe(在Windows env中)安裝的路徑。 因此,folder = File(“。”)是Mirth根文件夾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.