filegator icon indicating copy to clipboard operation
filegator copied to clipboard

[Feature Request] Unzip and overwrite existing files

Open adriancs2 opened this issue 1 year ago • 4 comments

A zip file is uploaded, and then an unzip is performed. Files extracted/unzip and new files created as follow (for example):

aaa.txt bbb.txt

when the zip file is extracted/unzip for 2nd time, the file list become as follow:

aaa.txt
aaa (1).txt  <-- unwanted duplicated
bbb.txt
bbb (1).txt  <-- unwanted duplicated

when the zip file is extracted/unzip for 3rd time, the file list become as follow:

aaa.txt
aaa (1).txt  <-- unwanted duplicated
aaa (2).txt  <-- unwanted duplicated
bbb.txt
bbb (1).txt  <-- unwanted duplicated
bbb (2).txt  <-- unwanted duplicated

Currently, to avoid duplicate files created, I need to first delete the existing files before unzip.

The problem is I want to update specific files (a lot), but not all files. I have to manually pick the specific files and delete them before unzip. This is highly inconvenient.

I also tried another attempt. which is by creating 2nd folder, unzip the content in 2nd folder, then copy all files from 2nd folder to the target folder, same thing happens. It won't overwrite the files, in stead, it creates duplicates files.

What configurations should be made in order to perform:

  1. unzip and overwrite
  2. copy and overwrite

I have tried to read through the documentations at: https://docs.filegator.io/index.html There is no info related to overwriting files mentioned in documentation.

If I search throught the configuation file --> configuration.php The most relevant that I can find is

overwrite_on_upload' => false,

Can you provide more insights of how to configure this?

  1. unzip and overwrite
  2. copy and overwrite

or if this feature is not implemented yet, I would like to request new feature for this, therefore in the configuration file, new options are available, for example:

<?php

return [
    'public_path' => APP_PUBLIC_PATH,
    'public_dir' => APP_PUBLIC_DIR,
    'overwrite_on_upload' => true,
    'overwrite_on_unzip' => true,    //  <-- new option
    'overwrite_on_copy' => true,     //  <-- new option
    'overwrite_on_move' => true,     //  <-- new option
    ...

adriancs2 avatar Mar 21 '23 23:03 adriancs2