Hi all,
I am fairly new to Syncovery and have a question that I believe pertains to the Job-related settings > PascalScript prompt.
I would like to append the subfolder name to the files contained within them before moving from left to right. I first tried using a Filename inclusion mask but this did not seem to work. I'm now attempting to use PascalScript to accomplish this, specifically the OnReplaceFilenameLeftToRight function. I've copied the function sample script which appends '-draft' to the filename, but how would I go about making this a dynamic variable that points to the subfolder name?
Thank you in advance.
Marissa
Using PascalScript to Append Subfolder to Filenames
Re: Using PascalScript to Append Subfolder to Filenames
For example:
Code: Select all
function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder or (CurrentSubPath='') then
Result:=FileName
else
Result:=FileName+StringReplace(CurrentSubPath,'\','_',false);
end;
Re: Using PascalScript to Append Subfolder to Filenames
Thank you Tobias! Is there a way to alter the position of the '.xml' file extension within this script? When applying this script currently, it appends in the middle of the file name, so I am then unable to open the file.
Re: Using PascalScript to Append Subfolder to Filenames
Please disregard - I was able to modify the script so the file name now appears at the end of the statement. Thank you again!
Re: Using PascalScript to Append Subfolder to Filenames
Hello,
great.
Just for reference, the recommende way to do it is this:
great.
Just for reference, the recommende way to do it is this:
Code: Select all
function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
const isFolder: Boolean):UnicodeString;
begin
if isFolder or (CurrentSubPath='') then
Result:=FileName
else
Result:=ChangeFileExt(FileName,StringReplace(CurrentSubPath,'\','_',false)+ExtractFileExt(FileName));
end;