Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune excluded directories #8

Closed
wefalltomorrow opened this issue Aug 24, 2019 · 5 comments
Closed

Prune excluded directories #8

wefalltomorrow opened this issue Aug 24, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@wefalltomorrow
Copy link

wefalltomorrow commented Aug 24, 2019

I have the following folders excluded for all drives:

*:\Windows*
*:$Recycle.Bin*
*:\Documents and Settings*
*:\System Volume Information*

Yet Compactor stills goes through each file in said folders whilst adding them to the total 'excluded' value, would it not be more efficient to not scan any excluded directories and subdirectories?

@Freaky Freaky added the enhancement New feature or request label Aug 25, 2019
@Freaky Freaky changed the title Ignore excluded directories from scan instead of scanning all files in excluded directories using unnecessary time and CPU/Ram Prune excluded directories Aug 25, 2019
@Dr-Emann
Copy link
Contributor

This would be really easy to do, where we say:

let walker = WalkDir::new(&self.path)
            .into_iter()
            ....
            .enumerate();

We just have to add a line saying:

let walker = WalkDir::new(&self.path)
            .into_iter()
            .filter_entry(|e| excludes.is_match(e.path()))
            ....
            .enumerate();

The only downside is that the number and size of excluded files will be inaccurate.

@Freaky
Copy link
Owner

Freaky commented Aug 25, 2019

I'd probably keep scanning excluded files in order to minimise the inaccuracy. Not much point skipping them - it doesn't make the directory scan much cheaper, just saves checking the compressed size.

It's notable that currently compressed files do not get checked against the excludes list - they go into the compressed pile, so you can still decompress them.

@agret
Copy link

agret commented Jan 18, 2020

I'd probably keep scanning excluded files in order to minimise the inaccuracy. Not much point skipping them - it doesn't make the directory scan much cheaper, just saves checking the compressed size.

If you are excluding the Windows folder for example it has many many subfolders with many files in each of those. Seems like a total waste of time to be crawling that when it's on the excluded list. There are many other cases where you might have a directory tree with tons of sub files that you don't want to waste time processing also.

@Freaky
Copy link
Owner

Freaky commented Jan 18, 2020

To be clear, if you've excluded a folder, it and all its contents are skipped entirely. If you've excluded a pattern of files inside a folder, like, say C:\bla\*.log, matching files will still have their compressed file size checked like any other file so it'll still give you an accurate assessment of the size of the folder.

I really should publish a new release with this in, shouldn't I :)

@Freaky
Copy link
Owner

Freaky commented Feb 29, 2020

Excluded subdirectories now pruned entirely in v0.8.0.

@Freaky Freaky closed this as completed Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants