我可以获取刚刚从已知文件夹移动到本机文件系统中某个位置的文件的绝对路径吗?
我最近正在开发一个 Java 桌面应用程序,该应用程序需要跟踪最近从已知源移动到本机文件系统中某个位置的文件路径。
例如: - 假设我在 %TEMP% 文件夹 (C:\Users\Admin\AppData\Local\Temp\A.txt) 中有一个文件 A.txt。现在操作系统将该文件移动到假设我的桌面。所以我想获取路径“C:\Users\Admin\Desktop\A.txt”。
如何从已知源获取最近移动的文件的未知目标路径?
请注意:
- 我们可以在本机文件系统上搜索文件名,但这会使过程缓慢且耗时。是否有任何快速搜索代码或 JAR,这将是一个开源的,可用的,可以在不消耗时间的情况下进行快速搜索。
- 我们可以与操作系统进行通信吗?它可以为我们提供最近移动的文件的路径,或者我们可以访问其日志或等等。
- 它必须适用于 Linux、MAC 和 Windows。
所以最后我们需要刚刚从已知文件夹移动到本机文件系统中某个位置的文件的绝对路径。
I am recently working on a Java desktop application which needs to track a path of file which has been recently moved to somewhere in native file system from the known source.
For Example : - Let's suppose i have a file A.txt in %TEMP% folder (C:\Users\Admin\AppData\Local\Temp\A.txt). Now Operating system moves that file to, suppose my Desktop. So i suppose to get the path "C:\Users\Admin\Desktop\A.txt".
How can I get the destination path, that's unknown, of recently moved file from known source?
Please Note:
- We can search the file name on Native file system but it makes the process slow and time consuming. Is there any fast searching code OR JAR, that would be a open source, available which can make a fast search without consuming time.
- Can we some who communicate with Operating system which can either give us the path of recently moved file OR we can access its logs Or etc..etc.
- It must work with Linux, MAC and Windows.
So finally we need the absolute path of just moved file to somewhere in native file system from known folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 jnotify 查看原始位置。
该库适用于 Linux、Windows 和 OSX。它会在移动事件中呼叫您。
You could watch the original location with jnotify.
This library work with linux, windows and OSX. It calls you on the move events.