Folder rename using PascalScript
Posted: Wed Jun 22, 2022 2:43 pm
For OneDrive/SharePoint, folders with the name "_vti" are not allowed due to the history of Front Page Extensions and whatnot. Anyway, I'm backing up a bunch of old stuff to OneDrive and it won't sync those folders. No problem, I see PascalScript seems to be able to handle this. I wrote a simple script, but I am not well versed in PascalScript and I'm getting a type mismatch error. I tried a lot of different things, like utf8encode/decode and stuff, no luck. Can somebody help?
function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder and FileName = '_vti' then
Result := 'RENAMED_vti'
else begin
Result := FileName
end;
end;
function OnReplaceFilenameRightToLeft(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder and FileName = 'RENAMED_vti' then
Result := '_vti'
else begin
Result := FileName
end;
end;
function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder and FileName = '_vti' then
Result := 'RENAMED_vti'
else begin
Result := FileName
end;
end;
function OnReplaceFilenameRightToLeft(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder and FileName = 'RENAMED_vti' then
Result := '_vti'
else begin
Result := FileName
end;
end;