汽车出口talend项目

时间:2018-03-28 09:10:33

标签: talend

我想每天在我的本地机器上导出我的Talend项目。我经常忘记手动执行此操作,如果有自动下载方式,这将非常有用。有没有办法可以每天自动导出你的Talend Open Studio项目?

2 个答案:

答案 0 :(得分:0)

没有内置的Talend功能可以执行此操作,但由于Talend项目只是一个包含子文件夹和文件的目录,因此您可以设置一个cron作业来归档项目的主文件夹和将其复制到另一个位置 7zip命令的示例:

Windows

7z.exe a -tzip /my/backup/folder/project.zip <TalendFolder>/workspace/PROJECT

Linux

7z a -tzip /my/backup/folder/project.zip <TalendFolder>/workspace/PROJECT

并通过Windows Scheduler(或带有cron作业的.sh)在.bat中安排此操作

答案 1 :(得分:0)

如果必须将文件复制到硬盘上,则上述代码可以正常工作。一旦有一个网络驱动器作为目标目录,该代码将花费很长时间处理TOS工作区中的数百万个小文件。

因此,我编写了以下脚本。 (请原谅德国内的言论。) 它基于7z和robocopy。

7z只能将新的/更改的文件添加到存档中,并且robocopy会将存档推送到网络共享上的目标文件夹中。

@echo off

echo.
echo --------------------------------
echo - start %date% %time% -
echo --------------------------------
echo.
echo.

REM choose working directory, where 7z should save the archive, before it is moved by robocopy
cd /D C:\Talend




REM define the name of your archive
set filename=TOS_DI_7.1_workspace_backup.7z

REM path of the directory, which should be put into the archive
set pathtobackup=C:\Talend\TOS_DI_7.1\workspace\

REM target path where the archive should be copied to
set destination=U:\Documents\TOS_DI_7.1\Backup\workspace


echo.
echo -------------------------------
echo - definition of the variables -
echo -------------------------------
echo.
echo This script creates an archive of the Talend Open Studio Workspace directory and copies it to the defined (network) directory.

echo current working direcotry:           %cd%
echo directory which is to be archived:   %pathtobackup%
echo name of the archive:                 %filename%
echo target directory:                    %destination%
echo directory for log files of robocopy: U:\Documents\TOS_DI_7.1\Backup\log\

REM please change log-directory below



echo.
echo.
echo --------------------------
echo - Start creating archive -
echo --------------------------
echo.
echo.

REM creation of archive
"C:\Program Files\7-Zip\7z.exe" u -up0q0r2x2y2z1w2 -t7z %filename% %pathtobackup%

echo.
echo ---------------------------------
echo - creation of archive completed -
echo ---------------------------------
echo.
echo.
echo.
echo -----------------
echo - Start copying -
echo -----------------
echo.
echo.    


REM robocopy copies the archive to the target directory
REM please change directory for log files here
robocopy %cd% %destination% %filename% /TEE/LOG+:"U:\Documents\TOS_DI_7.1\Backup\log\%date:~6,4%%date:~3,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%_log.txt"


echo.
echo -------------------------------
echo - end %date% %time% -
echo -------------------------------
echo.
echo.


pause