Skip to content

Files.inboundAdapter watchService - ignore subdirectories #3557

Closed
@szilardk

Description

@szilardk

Expected Behavior

Files.inboundAdapter(new File(dir))
        .useWatchService(true)

avoid listing the files from all subdirectoried

directory structure

/workDir
     /done
     /failed

would like to read all the files from /workDir and move them in done/failed after processing. in my scenario it is not useful to scan the subdirectories. it is just taking time if the subdirectories contain a lot of files.
i had a look in the WatchServiceDirectoryScanner.walkDirectory where Files.walkFileTree is used. this has "int maxDepth". would it make sense to expose this?

Current Behavior
current implementation would look for all files in all subdirectories.

Context
what i use now is

Files.inboundAdapter(new File(dir))
        .useWatchService(true)
        .filter 

with the filter i can eliminate everything i do not need. it would be even better if the subdirectories were not scanned at all since in my case there are 10K -100K files

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions