move file in 1 job to 2 locations

General Discussion in English
Post Reply
rkils
Posts: 2
Joined: Fri Apr 24, 2020 10:30 am

move file in 1 job to 2 locations

Post 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

tobias
Posts: 1640
Joined: Tue Mar 31, 2020 7:37 pm

Re: move file in 1 job to 2 locations

Post 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;

rkils
Posts: 2
Joined: Fri Apr 24, 2020 10:30 am

Re: move file in 1 job to 2 locations

Post by rkils »

thanks for this info. We will test it next week.

Post Reply