Skip to content

Instantly share code, notes, and snippets.

View nimpy's full-sized avatar
💭
Akku fast leer

Nina nimpy

💭
Akku fast leer
View GitHub Profile
@nimpy
nimpy / print_all_subdirs_sorted.py
Last active February 21, 2022 13:30
Print the names of all sub-directories for the current directory in sorted alphabetical order
# credit: https://stackoverflow.com/a/44228436/4031135
from pathlib import Path
p = Path('.')
# all subdirectories in the current directory, not recursive
list_subdirs = [f.name for f in p.iterdir() if f.is_dir()]
list_subdirs.sort()
for subdir in list_subdirs:
@nimpy
nimpy / print_all_subdirs_sorted_reverse.py
Created February 21, 2022 13:30
Print the names of all sub-directories for the current directory in reversely sorted alphabetical order
# credit: https://stackoverflow.com/a/44228436/4031135
from pathlib import Path
p = Path('.')
# all subdirectories in the current directory, not recursive
list_subdirs = [f.name for f in p.iterdir() if f.is_dir()]
list_subdirs = sorted(list_subdirs, reverse=True)
for subdir in list_subdirs:
DateTime=`date "+%Y-%m-%d %H:%M"`
echo $DateTime