next_dir(+quoted_atom, ?quoted_atom)

This built-in predicate retrieves the next subdirectory from the specified directory. The directory to scan is the first argument. The second argument is matched with the next subdirectory in the directory. If there was a next subdirectory the predicate is exited, else it fails.

see also: app_dir/1 base64_decode_file/2 base64_encode_file/2 compress_file/2 copy_file/2 current_dir/1 decompress_file/1 decompress_file/2 decrypt_file/3 delete_file/1 encrypt_file/3 exists_dir/1 exists_file/1 info_file/2 make_dir/1 md5_file/2 next_file/2 next_file/3 remove_dir/1 rename_file/2 set_current_dir/1 split_fn/2 unlink_file/1 wipe_file/1

Examples
next_dir('c:\\documents\\', Dir). If the specified directory does not contain any subdirectories then the predicate fails.
next_dir('c:\\documents\\', 'mydocs'). If the specified directory contains a subdirectory called 'mydocs' then the predicate exits, else it fails.

 

Exceptions
The first argument is an empty variable an instantiation_error exception is thrown
The first argument Directory is not an atom enclosed by single or double quotes A type_error(atom_singlequotes, Directory) exception is thrown
The second argument SubDir is neither a variable nor an atom enclosed by single or double quotes A type_error(atom_singlequotes, SubDir) exception is thrown

 

 

info@trinc-prolog.com