filemanager.FileOrganizer
A utility class for organizing files in standard directories like Downloads and Documents.
Usage
filemanager.FileOrganizer()Designed for integration into the labrat tool.
Methods
| Name | Description |
|---|---|
| __init__() | Initialize the FileOrganizer class with default directories. |
| move_file() | Move a file to the destination directory, handling duplicates and logging actions. |
| move_specific_files() | Move files containing a specific keyword in their names to a designated folder. |
| organize_all() | Execute all organizational tasks in sequence. |
| organize_archives() | Organize archives into subfolders by compression type. |
| organize_by_year() | Organize files into subfolders by year based on the last modified timestamp. |
| organize_documents() | Organize documents into subfolders by type and year. |
| organize_files() | Organize files into standard categories (e.g., Pictures, Videos). |
| organize_science_files() | Organize scientific data files into a dedicated research files folder. |
__init__()
Initialize the FileOrganizer class with default directories.
Usage
__init__()move_file()
Move a file to the destination directory, handling duplicates and logging actions.
Usage
move_file(src_file, dest_dir)Parameters
src_file: Path-
The source file to move.
dest_dir: Path- The destination directory where the file will be moved.
move_specific_files()
Move files containing a specific keyword in their names to a designated folder.
Usage
move_specific_files(keyword="specific")Parameters
keyword: str = "specific"- Keyword to match in filenames. Default is ‘specific’.
organize_all()
Execute all organizational tasks in sequence.
Usage
organize_all()organize_archives()
Organize archives into subfolders by compression type.
Usage
organize_archives()organize_by_year()
Organize files into subfolders by year based on the last modified timestamp.
Usage
organize_by_year(file_path, base_dir)Parameters
file_path: Path-
The file to organize.
base_dir: Path- The base directory where files are organized.
organize_documents()
Organize documents into subfolders by type and year.
Usage
organize_documents()organize_files()
Organize files into standard categories (e.g., Pictures, Videos).
Usage
organize_files()organize_science_files()
Organize scientific data files into a dedicated research files folder.
Usage
organize_science_files(science_dir=None)Handles common scientific file formats including: - Bioinformatics: fastq, fasta, sam, bam, vcf, bed, gff, gtf - Astronomy: fits, hdf5, nc (NetCDF) - General: csv, tsv, json, h5, parquet - Computational: ipynb, py, r, R
Parameters
science_dir: Path = None- Custom directory for science files. Defaults to Documents/Research_Data.