sadrive.commands.manipulation module#
Provides CLI commands for common SA-Drive operations: - newfolder: Create a new Drive folder and record it locally. - share: Share files or folders (recursive) and update DB. - rename: Rename a Drive item and update DB. - open_link: Open a Drive item in the browser. - details: Display storage usage table for all service accounts. - search: Interactive search of files/folders by name.
- sadrive.commands.manipulation.search_for_file(file_name: str, fuzzy: bool)[source]#
Search for files by name, either via Drive API fuzzy search or DB substring matching.
- Parameters:
file_name – The search term to match filenames against.
fuzzy – If True, perform fuzzy search through Drive API; else, use database LIKE search.
- Returns:
List of file detail dicts matching the search criteria.
- Behavior:
Fuzzy: Retrieves Drive files via SADrive.search, then filters those present in the DB.
Non-fuzzy: Directly queries DB for filenames containing the term.
Share a single file by granting reader permission to anyone.
- Parameters:
sa_num – Service account number as string.
file_id – Drive file or folder ID.
- Returns:
Shareable link for the item.
Recursively mark all items inside a folder as shared.
- Parameters:
file_id – ID of the parent folder.