Page 1 of 1
move file in 1 job to 2 locations
Posted: Fri Apr 24, 2020 10:35 am
by rkils
Hi All,
does anyone know if it is possible to move one (or multiple)file in 1 job to 2 differ locations?
ftp-server\file1 => c:\prodution
d:\archive
thanks Robert
Re: move file in 1 job to 2 locations
Posted: Fri Apr 24, 2020 11:51 am
by tobias
Hello,
yes, absolutely.
In the most simple case, the Archive folder would be on the FTP Server. To achieve this, use the "Move Files to Destination" mode, and specify the archive folder as a "Folder for deleted files" on the left side.
Under Files->Deletions, click on "Move Deleted Files Into A Specified Folder..." and specify the folder for the "L:" side like this:
../Archive
or
/Archive
See the examples on the dialog.
If the archive folder must be on your local machine, you cannot use this method.
Instead, paste the following PascalScript into the profile via Job->PascalScript. Note that the script will only work if the file will stay in the download folder for a few seconds. If your production system moves it away or deletes it too quickly, it will fail. If that is the case, you would need to use the Archive folder as main profile destination, and change the script to copy the downloaded file to the production folder.
Note that the archive folder must already exist for this script to work.
Code: Select all
function OnDownloadComplete(const FileName, CompleteURL, LocalFilePath: UnicodeString;
const isRightSide:Boolean;
const FileSize:Int64;
const Connector: Opaque):Boolean;
begin
Execute('XCOPY.EXE "'+LocalFilePath+'" D:\Archive /Y',60);
Result:=true;
end;
Re: move file in 1 job to 2 locations
Posted: Fri Apr 24, 2020 1:19 pm
by rkils
thanks for this info. We will test it next week.