File.Move锁定在目标文件夹中的文件? [英] File.Move locks file in destination folder?

查看:160
本文介绍了File.Move锁定在目标文件夹中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 File.Move 从目录到另一个directory.The desitnation文件夹监控2GB左右移动大文件,如果有任何新的文件,这将是上传到CDN。但是,我们经历了一些局部的文件上传到CDN,这意味着,相应的文件上传到CDN而同样的文件是从源移动到目标目录。所以,我需要知道是否File.Move锁定该文件的目标文件夹,直到文件完成感动?

I use File.Move to move large files around 2GB from a directory to another directory.The desitnation folder is monitored and if there is any new file, it will be uploaded to CDN. But we experienced some partial file upload to CDN which means, the respective file was uploaded to CDN while the same file was moving from source to destination directory. So, I need to know whether File.Move locks the file destination folder till the file is completed moved?

推荐答案

您的问题是在目标文件夹中的moonitoring。

Your problem is the moonitoring on the destination folder.

既然你有一个大的文件,它需要时间来复制它,发生了什么是:

Since you have a big file, it take time to copy it so what happend is :


  1. 您开始移动文件

  2. 监控系统踢并开始上传到CDN

  3. 文件被上传parialy

  4. 您完成移动文件。

这其中的一个缓解措施是,假设你的监控系统寻找一些extensation文件 - 移动 MyBigFile.ext MyBigFile.ext.tmp 。完成后,其重命名为 MyBigFile.ext ,所以在监控踢时,将拥有完整的文件

One mitigation for this is , assuming your monitoring system searching for files with some extensation - moving MyBigFile.ext to MyBigFile.ext.tmp. after finish , rename it back to MyBigFile.ext, so when monitoring kick in , it will have the complete file

这篇关于File.Move锁定在目标文件夹中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆