local fileCutil = CTNFileUtil();

-- 根据筛选条件从指定目录获取文件列表至help
local sPath = [[E:/test_class/test_class_4/]];
local sPathDir = [[E:/test_class]];
local help = CSelectHelp();
fileCutil:enumFilesInDirectoryWithFilter('*.txt', sPath, help);
-- 在原有help中增加一列,不改变原有数据 
help:addFieldWithData('file_path', '');

for i=help:size()-1,0,-1 do
    sTmp = string.gsub(help:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    help:setValueString(i, 'file_path', sTmp);
end
help:dumpEx('=======');


-- 从指定目录获取目录列表至help(含子目录)
local helpDir = CSelectHelp();
fileCutil:enumAllDirectories(sPathDir, helpDir);
-- 在原有help中增加一列,不改变原有数据
helpDir:addFieldWithData('file_path', '');

for i=helpDir:size()-1,0,-1 do
    sTmp = string.gsub(helpDir:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    helpDir:setValueString(i, 'file_path', sTmp);
end
helpDir:dumpEx('=======');


-- 根据筛选条件从指定目录获取目录列表至help(不含子目录)
local helpDirPart = CSelectHelp();
fileCutil:enumDirectories(sPathDir, helpDirPart);
-- 在原有help中增加一列,不改变原有数据
helpDirPart:addFieldWithData('file_path', '');

for i=helpDirPart:size()-1,0,-1 do
    sTmp = string.gsub(helpDirPart:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    helpDirPart:setValueString(i, 'file_path', sTmp);
end
helpDirPart:dumpEx('=======');


-- 从指定目录获取文件列表至help(获取文件)
local helpDirFile = CSelectHelp();
fileCutil:enumFilesInDirectory(sPathDir, helpDirFile);
-- 在原有help中增加一列,不改变原有数据
helpDirFile:addFieldWithData('file_path', '');

for i=helpDirFile:size()-1,0,-1 do
    sTmp = string.gsub(helpDirFile:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    helpDirFile:setValueString(i, 'file_path', sTmp);
end
helpDirFile:dumpEx('=======');


-- 从指定目录获取文件列表至help(含子目录)
local helpAssDirFile = CSelectHelp();
fileCutil:enumAllFiles(sPathDir, helpAssDirFile);
-- 在原有help中增加一列,不改变原有数据
helpAssDirFile:addFieldWithData('file_path', '');

for i=helpAssDirFile:size()-1,0,-1 do
    sTmp = string.gsub(helpAssDirFile:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    helpAssDirFile:setValueString(i, 'file_path', sTmp);
end
helpAssDirFile:dumpEx('=======');


-- 根据筛选条件从指定目录获取文件列表至help(含子目录)
local helpAssDirFileAll = CSelectHelp();
fileCutil:enumAllFilesWithFilter('*.txt',sPathDir, helpAssDirFileAll);
-- 在原有help中增加一列,不改变原有数据
helpAssDirFileAll:addFieldWithData('file_path', '');

for i=helpAssDirFileAll:size()-1,0,-1 do
    sTmp = string.gsub(helpAssDirFileAll:vs(i, 'name'), sPath, '');
    -- 用于更新help内容
    helpAssDirFileAll:setValueString(i, 'file_path', sTmp);
end
helpAssDirFileAll:dumpEx('=======');



local sSourcePath = [[E:/test_class/test_class_4/]];
local sDestPath = [[E:/test_class/test_class_4_new/]];

-- 重命名目录
if fileCutil:renameDirectory(sSourcePath, sDestPath) == true then
    ui:tip('success');
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""