pentaho使用MM-YYYY创建存档文件夹 [英] pentaho create archive folder with MM-YYYY

查看:75
本文介绍了pentaho使用MM-YYYY创建存档文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过将每个文件放在另一个具有以下名称的存档文件夹中来存档该文件:"Archive/myfolder-06-2014"

I would like to archive every file in a folder by putting it in another archive folder with a name like this: "Archive/myfolder-06-2014"

我的问题是如何检索当前的月份和年份,然后如何使用这些数据创建文件夹(如果尚不存在).

My problem is how to retrieve the current month and year and then how to create a folder (if it does not already exist) with these data.

推荐答案

此解决方案可能有点笨拙(由于必要的大惊小怪),但似乎可行.想法是在单独的转换中预先计算目标文件名,并将其存储为系统变量(TARGET_ZIP_FILENAME):

This solution may be a little awkward (due to the required fuss) but it seems to work. The idea is to precompute the target filename in a seperate transformation and store it as a system variable (TARGET_ZIP_FILENAME):

下图显示了所选组件的设置.

The following diagrams show the settings of selected components.

  • 获取当前时间...

  • 提供目标文件名的模式作为字符串常量...

  • 将月份和年份提取为格式化的整数...

  • 替换模式中的月份(年份将等效)

  • 将结果文件名设置为系统变量

主作业将调用转换并将系统变量用作zip目标文件名.

The main job will call the transformation and use the system variable as the zip target filename.

还必须确保设置Create Parent folder处于活动状态:

Also you have to make sure that the setting Create Parent folder is active:

这篇关于pentaho使用MM-YYYY创建存档文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆