2010年6月28日月曜日

groovyとJCIFSでWindows共有上のファイルの作成日時を設定する

groovyとJCIFSでWindows共有上のファイルの作成日時を設定するには、以下のコードを実行します。

import jcifs.smb.*

domain = "workgroup"
user = "testuser"
password = "password"
server = "win01"
path = "sharedir"
file = "test1.txt"

file = new SmbFile(
"smb://${domain};${user}:${password}@${server}/${path}/${file}"
)

// windows共有上のファイルの作成日時を設定する
file.setCreateTime(
new GregorianCalendar(2010, 5-1, 5, 0, 10, 30).timeInMillis
)


動作環境
groovy 1.7.1, JDK6 Update19, JCIFS 1.3.14

関連情報
JCIFSまとめ

0 件のコメント:

コメントを投稿