script-server icon indicating copy to clipboard operation
script-server copied to clipboard

(Optionally) avoid copying downloadable files?

Open floe opened this issue 1 year ago • 5 comments

Hi, thanks for writing script-server, quite useful!

I have a usecase where my script is generating rather large MP4 files, and every time I run it, all output files (including the ones from previous runs) get copied to a temp folder. This takes quite a bit of time and disk space, so I was wondering if there is a way to avoid the copy step? Maybe just soft-link them instead?

floe avatar Jun 24 '23 08:06 floe

(I'd also be fine with a pointer to the right spot in the code where I can patch this locally, but I haven't found it yet.)

floe avatar Jun 24 '23 10:06 floe

Hi @floe unfortunately this is not possible to configure. I don't understand, though, why is it copying files from the previous runs. May be the search pattern finds them as well

You can check the following code here: https://github.com/bugy/script-server/blob/f0fc7cfe4de55eefe6e4a0939661948de198a63b/src/features/file_download_feature.py#L221 Soft links might work for you

bugy avatar Jun 24 '23 12:06 bugy

Thanks! I'll give it a try. (AFAICT just need to replace copyfile with os.link and that's it.)

floe avatar Jun 24 '23 13:06 floe

Thanks! I'll give it a try. (AFAICT just need to replace copyfile with os.link and that's it.)

Just for the record, I did exactly that and it works like a charm 👍

floe avatar Aug 10 '23 13:08 floe

Great, thanks for the info!

bugy avatar Aug 10 '23 13:08 bugy