Pre-caching files when touched

I haven't seen this anywhere in any of the user guides I've read through so this may become a feature request but want to make sure I haven't missed anything first. I'm using nfsmount and I'm wondering if there's any way to cache individual files when they're touched. This isn't about a file listing for faster browsing but individual files.

This isn't my specific use case, but as an example, when a file is selected in Finder, rclone fetches the metadata and a thumbnail is displayed. It would be really useful for me if it could begin caching the file as soon as it's selected, rather than only beginning to cache when the file is opened. Is there a way to do this?

welcome to the forum,

write a simple script, which is added to the context menu of Finder.
https://stackoverflow.com/questions/4215287/adding-a-script-to-macos-finder-contextual-menu

have the script read the entire file, which would force rclone to download the entire file into the cache.
there are a few ways to do that.

  1. calculate the md5sum of the entire file
    md5sum name_of_file.ext
  2. copy the entire file to nul
    cp name_of_file.ext > /dev/null

At least a bit of file is read when finder access it. To make sure that all is read tweak chunked reading parameters. Default is --vfs-read-chunk-size 100M . Increase this value to read more.

Thank you both for your responses. Lesson learned, I should use my actual workflow instead of using Finder as an example. Those methods do work for Finder.

However, my workflow doesn't seem to actually be reading the file when referenced. Watching the -vv output, it looks like all it does is go down each folder in the folder tree and then verify the file's existence and does not actually read any of the file.

Essentially what I'm doing is using a media asset manager and have Box as my secondary storage for when files age out of being stored on our NAS. When a user looks at a file through the MAM in the browser, it seems to verify the file's existence but does not load the metadata or download a chunk to cache. Then, when the user chooses to download, it does not actually trigger the download process for on the user's side until a chunk has been downloaded to cache, which causes a delay for them.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.