-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description:
Develop a Python function that lists all hidden files in a specified directory. The function should be compatible with Windows, Linux, and macOS operating systems.
Requirements:
- Function Name:
get_hidden_files - Parameters:
directory(str): The path to the directory where hidden files need to be listed.
- Returns:
- A list of hidden files in the specified directory.
Specifications:
- The function should use the
osmodule to interact with the file system. - For Windows, hidden files are identified by the
FILE_ATTRIBUTE_HIDDENattribute. - For Linux and macOS, hidden files are identified by a leading dot (
.) in the filename. - The function should handle exceptions gracefully, such as invalid directory paths or permission errors.
Example Usage:
from filesystem import file as fsfile
hidden_files = fsfile.get_hidden_files('/path/to/directory')
print(hidden_files)Implementation Hints:
- Use
file.get_files()to list all files in the directory. - For Windows, consider using the
ctypeslibrary to check file attributes.
Additional Notes:
- Ensure the function is well-documented with comments explaining each step.
- Write unit tests to verify the function works correctly on all three operating systems.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request