I want to select multiple files and generate a .7z of each single file - not .zip.
A copy archive=.7z,single HERE ? doesn't work. ... Any other idea?
After that I want to rename all created .7z files (should be selected) with timestamps which should be command: Rename PATTERN="*.7z" TO="*_{modified|D#yyyyMMddTT#HHmmss}.*" AUTORENAME TYPE=files
After reading Scripting Objects reference guide, and Date section, I'm still unable to add timestamp to Zip Single.dcf button.
I have to create an object, but I'm definitely fighting wrong way.
Added this: var dat = DOpusFactory.Date
later when file is defined, added: f.name_stem_m + dat.Format("D#yyyy-MM-dd T#HH:mm:ss") +".zip";
function OnClick(clickData)
{
var source = clickData.func.sourcetab;
var cmd = clickData.func.command;
var work = false;
var dat = DOpus.Create().Date();
cmd.deselect = false; // Leave source files selected.
cmd.ClearFiles();
for (var e = new Enumerator(source.selected); !e.atEnd(); e.moveNext())
{
var f = e.item();
if (IsEmptyDir(f))
{
var arcName = f.Path + "\\" + f.name_stem_m + dat.Format("D#yyyy-MM-dd-T#HH-mm-ss") + ".zip";
// only .zip is created
if (!DOpus.FSUtil.Exists(arcName))
{
work = true;
cmd.AddLine("CreateFolder NAME=\"" + arcName + "\" ARCHIVE=.ZIP READAUTO=no NOUPDATESETTINGS");
}
}
else
{
work = true;
cmd.AddLine("Copy FILE=\"" + f.RealPath + "\" TO=\"" + f.Path + "\" ARCHIVE=.ZIP CREATEFOLDER=\"" + dat.Format("D#yyyy-MM-dd-T#HH-mm-ss") + ".zip\"");
// IF PLACED HEREzip contains only timestamp, no selected filenames anymore
}
}
if (work)
{
cmd.Run();
}
}
function IsEmptyDir(item)
{
if (!item.is_dir)
{
return false;
}
var fe = DOpus.FSUtil.ReadDir(item.RealPath);
return fe.complete;
}
Or I get empty filename, or timestamp only. Guess in this heat my brains are melting and don't understand this piece.