Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

[FEATURE REQUEST] Remove folder #76

Closed
annymosse opened this issue Feb 12, 2019 · 6 comments
Closed

[FEATURE REQUEST] Remove folder #76

annymosse opened this issue Feb 12, 2019 · 6 comments

Comments

@annymosse
Copy link

this lib is great but still missing few of features such as remove folder, get files list inside a folder compress folder inside a [zip|tar|gz|7z|...]
good luck with your job and activities @RomainLanz

@RomainLanz
Copy link
Member

Hey @annymosse! 👋

This is out-of-scope of this package.
Feel free to use the driver() method in the next release to have access to the real driver behind our abstraction to do what you wanna do.

@RomainLanz RomainLanz removed this from the 1.0.0 milestone Mar 17, 2019
@annymosse
Copy link
Author

Hey @annymosse!

This is out-of-scope of this package.
Feel free to use the driver() method in the next release to have access to the real driver behind our abstraction to do what you wanna do.

im using adonis and using driver() but cant get files inside a folder or remove a folder or compress a folder,i solved these features using glob lib and others libs,thanks

@Nightbr
Copy link

Nightbr commented Apr 1, 2021

Hey, really interested in this feature, @annymosse could you share your solution?
Try to remove a folder with all its content but in an optimized way (not have to recursively delete all files).
Thanks 🙏

@annymosse
Copy link
Author

Hey, really interested in this feature, @annymosse could you share your solution?

as i had mentioned above i made (before longtime ago since 2019) a mixed solution with other libs such as glob for listing my files in array to do my own stuffs before delete these files recursively & rimraf.

Try to remove a folder with all its content but in an optimized way (not have to recursively delete all files).

As current of time i don't think there's a solution to remove folders with their contents without a recursive method (at least in *Unix OS).

There's ability to fix that old solution and provide a modern feature inside the kernels of these OS , since there's a new languages are planing to replace these old hard languages such as c & c++ with modern syntax and ability to reuse code/libs such as Zig lang, Rust lang and V lang even there's new OS made by rust and v.
Sorry for my delay to reply @Nightbr , and thanks for your interests.

@Nightbr
Copy link

Nightbr commented Apr 14, 2021

For S3 driver, I use this method: https://github.com/bingtimren/s3-commons/blob/master/src/lib/deleteRecursive.ts
And usage is:

    const driver: S3 = this.myDisk.driver();
    const count = await deleteRecursive(driver, this.bucket, id + '/');
    return count;

It will optimize the Bulk delete using deleteObjects.

@annymosse
Copy link
Author

@Nightbr as you can see at the function definition https://github.com/bingtimren/s3-commons/blob/878f0c8c7fae98c5d4b7036f21f549fc902c490d/src/lib/deleteRecursive.ts#L7 even S3 (which use Amazon Linux) there's no modified Linux kernel which let it stuck with recursive method too, however because there's a key value feature (as i know it use hyper-storage for indexing and versioning history data) which is used to index the files and eliminate the need to recursively listing all sub-tree files/folders structures, @Nightbr ,if there's no plan to add remove folders without recursive method into the kernels i think your idea it's the best solution, adding a cache layer such as Redis to keep the structures up-to-date always and remove the folders using that cache without reading the trees each time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants