Guide 3 - Directories

Directories can be treated the same as files. We can perform exactly the same operations on them and even more. Let us start with a simple command that finds all directories that are not empty.

select directories where not empty

Find all directories that contain a file a.txt. Note: this is not recursive traversation. The next 5 snippets of code also do not apply recursiveness.

select directories
  where existsInside('a.txt')

Find all directories that contain three files: a.txt, b.txt, c.txt. They have to contain all these files at once.

f = 'a.txt', 'b.txt', 'c.txt';
select directories where existInside(f)

Find all directories that contain at least three files.

select directories
  where countInside(files) >= 3

Find all directories that contain at least one file.

select directories
  where anyInside(files)

Find all directories that contain at least one file with specified extension.

select directories
  where anyInside(files
    where extension in ('mp3', 'wav', 'flac'))

Find all directories that contain at least one mp3 file.

select directories
  where anyInside('*.mp3')

Find all directories that contain at least one file data.txt in their entire directory trees.

select directories
  where anyInside('**/data.txt')

Two recent commands apply Asterisk Patterns. This is another broad topic explained here.

Next