https://github.com/seigtm/directoryfileslist
Implementation of the C++ function that returns a list of files in a certain directory by a given mask (file extension). It's my homework task on the subject "Information security".
https://github.com/seigtm/directoryfileslist
cpp cpp-examples directory file file-list files files-list filesystem list-files std-library
Last synced: about 1 month ago
JSON representation
Implementation of the C++ function that returns a list of files in a certain directory by a given mask (file extension). It's my homework task on the subject "Information security".
- Host: GitHub
- URL: https://github.com/seigtm/directoryfileslist
- Owner: seigtm
- Archived: true
- Created: 2021-04-20T20:48:56.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-22T16:47:47.000Z (about 4 years ago)
- Last Synced: 2025-02-23T03:46:53.789Z (3 months ago)
- Topics: cpp, cpp-examples, directory, file, file-list, files, files-list, filesystem, list-files, std-library
- Language: C++
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# List files in a directory C++ function.
Implementation of the C++ function that returns a list of files in a certain directory by a given mask (file extension).
``` cpp
// Returns a vector of file name strings in some directory with some extension.
std::vector getDirectoryFiles(const fs::path &directory = fs::current_path(),
const std::vector extensions = {})
```
It's my homework task on the subject "Information security".
## Usage examples:
> Returns the list of the names of all files in the current directory.
``` cpp
auto fileList = getDirectoryFiles();
```
> Returns the list of the names of all files in the current directory with the "*.exe" extension.
``` cpp
auto fileList = getDirectoryFiles(fs::current_path(), {".exe"});
```
> Returns the list of the names of all files in the current directory with the ".png", ".bmp" or ".jpg" extension.
``` cpp
auto fileList = getDirectoryFiles(fs::current_path(), {".png", ".bmp", ".jpg"});
```