filemanager.FileOrganizer

A utility class for organizing files in standard directories like Downloads and Documents.

Usage

Source

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

Source

__init__()

move_file()

Move a file to the destination directory, handling duplicates and logging actions.

Usage

Source

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

Source

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

Source

organize_all()

organize_archives()

Organize archives into subfolders by compression type.

Usage

Source

organize_archives()

organize_by_year()

Organize files into subfolders by year based on the last modified timestamp.

Usage

Source

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

Source

organize_documents()

organize_files()

Organize files into standard categories (e.g., Pictures, Videos).

Usage

Source

organize_files()

organize_science_files()

Organize scientific data files into a dedicated research files folder.

Usage

Source

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.