Bookmarks #
Well, seems like you've found this not-so-secret page :)
This Page is under construction []
JELLYFIN MEDIA PLAYER SCALE FACTOR
"C:\Program Files\Jellyfin\Jellyfin Media Player\JellyfinMediaPlayer.exe" --scale-factor 1.10
JELLYFIN CUSTOM CSS
@import url('https://cdn.jsdelivr.net/gh/loof2736/scyfin@v1.0.17/CSS/css-scyfin/scyfin-theme-backdrop.css');
.adminDrawerLogo img { content: url(https://i.imgur.com/adhRKTl.png) !important; } imgLogoIcon { content: url(https://i.imgur.com/adhRKTl.png) !important; } .pageTitleWithLogo { background-image: url(https://i.imgur.com/adhRKTl.png) !important; }
FILE ORGANIZER
A Python script that organizes files in a folder by their last modified date. Users can sort files into folders by year or month and year. It handles duplicates, shows progress with tqdm, and provides a simple CLI for input.
import os
import shutil
import datetime
import time
from tqdm import tqdm
def get_creation_date(file_path):
"""Get file creation date."""
try:
# Get file stats
stat = os.stat(file_path)
# Try to use creation time first, fall back to modification time
# ctime isn't reliable across platforms, so we'll use mtime
return datetime.datetime.fromtimestamp(stat.st_mtime)
except Exception as e:
print(f"Error getting date for {file_path}: {e}")
# Return current date as fallback
return datetime.datetime.now()
def organize_files_by_date(source_dir, sort_type):
"""
Organize files from source directory based on creation date.
sort_type: 'month' or 'year'
"""
# Ensure source directory exists
if not os.path.exists(source_dir):
print(f"Error: Directory '{source_dir}' does not exist.")
return
# Get all files (not directories) in the source directory
all_files = []
for root, dirs, files in os.walk(source_dir):
for file in files:
all_files.append(os.path.join(root, file))
total_files = len(all_files)
if total_files == 0:
print("No files found in the directory.")
return
print(f"Found {total_files} files to organize.")
processed_files = 0
skipped_files = 0
# Process files with progress bar
with tqdm(total=total_files, desc="Processing files", unit="file") as pbar:
for file_path in all_files:
try:
# Skip if it's a directory (should be caught by os.walk, but just in case)
if os.path.isdir(file_path):
skipped_files += 1
pbar.update(1)
continue
# Get file creation date
date = get_creation_date(file_path)
year = str(date.year)
month = date.strftime("%m-%B") # Format: "01-January"
# Determine target directory
if sort_type == 'month':
target_dir = os.path.join(source_dir, year, month)
else: # year
target_dir = os.path.join(source_dir, year)
# Create target directory if it doesn't exist
os.makedirs(target_dir, exist_ok=True)
# Get filename without path
filename = os.path.basename(file_path)
target_path = os.path.join(target_dir, filename)
# Handle duplicate filenames
if os.path.exists(target_path) and os.path.samefile(file_path, target_path):
# Skip if source and destination are the same file
pbar.write(
f"Skipping {filename} - already in correct location")
skipped_files += 1
elif os.path.exists(target_path):
# Handle duplicate by adding a counter
name, ext = os.path.splitext(filename)
counter = 1
while os.path.exists(os.path.join(target_dir, f"{name}_{counter}{ext}")):
counter += 1
new_filename = f"{name}_{counter}{ext}"
target_path = os.path.join(target_dir, new_filename)
shutil.move(file_path, target_path)
pbar.write(
f"Moved {filename} to {target_dir} as {new_filename} (renamed due to duplicate)")
processed_files += 1
else:
# Move the file
shutil.move(file_path, target_path)
pbar.write(f"Moved {filename} to {target_dir}")
processed_files += 1
except Exception as e:
pbar.write(f"Error processing {file_path}: {e}")
skipped_files += 1
# Update progress bar
pbar.update(1)
# Small delay to show progress (optional)
time.sleep(0.01)
# Print summary
print("\nOrganization Complete!")
print(f"Total files: {total_files}")
print(f"Files processed: {processed_files}")
print(f"Files skipped: {skipped_files}")
def main():
print("=" * 50)
print("File Organizer by Creation Date".center(50))
print("=" * 50)
# Get source directory
while True:
source_dir = input("\nEnter the folder path to organize: ").strip()
if source_dir and os.path.exists(source_dir):
break
print("Error: Please enter a valid directory path.")
# Count files in directory
file_count = sum(len(files) for _, _, files in os.walk(source_dir))
print(f"\nFound {file_count} files in the directory.")
# Show menu
print("\nOrganization Options:")
print("1. Sort by Month and Year (Year/Month folders)")
print("2. Sort by Year only (Year folders)")
print("3. Exit")
while True:
choice = input("\nEnter your choice (1-3): ").strip()
if choice == '1':
print("\nOrganizing files by month and year...")
organize_files_by_date(source_dir, 'month')
break
elif choice == '2':
print("\nOrganizing files by year...")
organize_files_by_date(source_dir, 'year')
break
elif choice == '3':
print("Exiting program.")
return
else:
print("Invalid choice. Please select a valid option (1-3).")
if __name__ == "__main__":
main()