您如何使用应用程序跟踪 SMB 中的文件? [英] How do you track files in SMB with an application?

查看:41
本文介绍了您如何使用应用程序跟踪 SMB 中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 PHP 构建了一个应用程序,它显示了用户主目录中的所有文件,该目录也可以通过 samba 访问,因此您可以从 windows、mac 和 linux 中的本机资源管理器访问它.我想给每个文件一个 ID,这样我就可以为每个文件分配标签,你会怎么做呢?您是否会对文件进行哈希处理并查看它是否是相同的文件哈希并因此得出结论它是相同的文件?

I have built an application with PHP which shows all the files in the home directory of a user this directory is also available via samba so you can access it from the native explorer in windows, mac and linux. I wanted to give every file an ID so that I can asign tags to every file how would you go about doing this? Would you make hashs of the file and look whether its the same filehash and would thus conclude that its the same file?

我可以在每次移动文件或文件夹时触发 samba 发送内容吗?

Can I trigger samba to send out something everytime a file or folder gets moved?

推荐答案

要回答您的第一个问题,制作哈希当然可以.只需在文件上使用 md5 就足够了.散列主目录中的文件时发生冲突的可能性非常小.IMO 我什至会说不值得一提.这可能不言而喻,但是...我会至少存储散列和完整路径,这样你就可以适当地处理移动的文件,并且实际上做一些事情文件.

To answer your first question, making a hash would of course work. Simply using md5 on the files would be sufficient. The chances of a collision while hashing the files in your home directory are insanely small. IMO I would say not even worth mentioning. And it probably goes without saying but... I would store at least the hash and the full path, so you can deal with moved files appropriately, and actually do something with the file.

这篇关于您如何使用应用程序跟踪 SMB 中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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