cli icon indicating copy to clipboard operation
cli copied to clipboard

supabase storage cp -r: Skip existing files

Open markosnarinian opened this issue 7 months ago • 4 comments

Is your feature request related to a problem? Please describe. I need to upload some tens of thousands of files (now on my laptop) to a Supabase storage bucket. I chose to use the CLI for this as uploading through the browser proved unreliable. TLDR: I was frustrated when the transfer (using Supabase CLI) was interrupted and there was no straightforward way to skip copying existing files to the bucket.

Describe the solution you'd like Introduce a -n flag for the cp command that skips recreating existing files.

Additional context I'm curious about how Supabase CLI uploads files to buckets, about how it works under the hood and whether or not something like this can be easily implemented.

Update See comment below.

markosnarinian avatar Apr 29 '26 17:04 markosnarinian

I just looked into the code. If you don't use the --recursive flag skipping existing files doesn't matter much (correct me if I'm wrong). On the other hand, if you do use the --recursive flag, which means that you're copying many files at once, the option to skip existing files is essential, especially if you're uploading using an unstable connection and/or a large number of files like me. It seems like overwriting is hardcoded:

opts = append(opts, func(fo *storage.FileOptions) {
		fo.Overwrite = true
	})

I'll submit a pull request that fixes this, soon.

UPDATE: fo.Overwrite just adds the upsert header to the API request, doesn't skip anything.

markosnarinian avatar Apr 29 '26 17:04 markosnarinian

I think that we should check for existing files once, not on every upload job. It seems significantly faster. I'll try to work on it.

markosnarinian avatar May 01 '26 05:05 markosnarinian

You can also use rclone to upload to supabase storage bucket.

singh-inder avatar May 01 '26 09:05 singh-inder

Hi! Thanks for opening this issue.

We're closing this because it has not had any activity for 45 days, and we try to keep the Supabase CLI issue tracker focused on reports that are still current.

If this still reproduces on the latest Supabase CLI, please comment with /reopen on its own line and include your CLI version, updated reproduction steps, and any recent error output. We appreciate the signal and are happy to take another look.

github-actions[bot] avatar Jun 17 '26 18:06 github-actions[bot]