简体   繁体   English

使用 twaitforfile 或自定义 java 代码将文件从一个目录传输到另一个目录时如何诱导时间延迟?

[英]How to induce a timedelay when transferring the file from one directory to another by using twaitforfile or custom java code?

I am using talend to pickup file from source folder and transfer to the destination folder,however i want to pickup the file for processing only if the file is completely written in the source or not during/when the file is actively being copied into the source folder.我正在使用 talend 从源文件夹中拾取文件并传输到目标文件夹,但是我只想在文件完全写入源文件或文件被主动复制到源文件期间/期间不拾取文件进行处理文件夹。

I realize that in talend when trying to move the file from source to dest.我在尝试将文件从源移动到目标时意识到这一点。 when the file is being still written into source folder-it shows an error message that "file is still being used by another proces" however i dont want that error to be triggered for each every run,i would want to skip and move to the next file in the iteration folder.当文件仍被写入源文件夹时 - 它显示一条错误消息“文件仍在被另一个进程使用”但是我不希望每次运行都触发该错误,我想跳过并移至迭代文件夹中的下一个文件。

Can i use a twait or twaitforfile between components or add java code to handle it such that "presenttime(sysdate)-filetime(arrivaltimeinto the folder)>timedifference(lets say around 3-5 minutes)"我可以在组件之间使用 twait 或 twaitforfile 或添加 java 代码来处理它,这样“presenttime(sysdate)-filetime(到达文件夹)>timedifference(让我们说大约 3-5 分钟)”

Only if the condition is satisfied move the file to destination folder.仅当满足条件时才将文件移动到目标文件夹。

Please suggest which is the best efficient way to handle this.请建议哪种方法是处理此问题的最佳有效方法。

In advanced settings of tWaitForFile, you have an option "WAIT_RELEASE": you can set it, and when a file is detected, it will perform a 2d check XXXms after the first one, to make sure that the file is released (so that it is not actively being copied to the repository).在 tWaitForFile 的高级设置中,你有一个选项“WAIT_RELEASE”:你可以设置它,当检测到一个文件时,它会在第一个文件之后执行 2d 检查 XXXms,以确保文件被释放(以便它没有被主动复制到存储库)。 When the file is fully copied, you are then able to use it.文件完全复制后,您就可以使用它了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用java将文件一个目录移动到另一个目录 - How to move file one directory to another directory using in java 如何诱导或帮助Java编译器优化代码? - How to induce or help Java Compilers to optimize code? 将源代码从一台PC传输到另一台PC - Transferring source code from one pc to another 如何使用 Java SFTP 库 JSch 将文件从一个目录传输到另一个目录? - How do I transfer a file from one directory to another using Java SFTP Library JSch? 使用Java将文件从一个目录移动到另一个目录并从源目录删除 - Moving file from one directory to another and delete from source directory using java 从一个类而不是另一个类读取 Java 中的属性文件时没有这样的文件或目录 - No such file or directory when reading Properties File in Java from one Class but not another 使用JAVA从HDFS中的一个目录复制到HDFS中的另一个目录 - Copying from one directory in HDFS to another directory in HDFS using JAVA 从一个ArrayList转移到另一个 - Transferring from one ArrayList to another 如何将文件从目录复制到Java中的另一个目录 - How to copy file from directory to another Directory in Java 如何在Java中将wav文件从一个目录复制到另一个目录? - How can I copy a wav file from one directory to another in java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM