DEV Community


Posted on • Updated on

Collection of my automated tasks

I have created a collection of automated tasks written in python.

Check it out at GitHub:
Starts are appreciated 😃

I have created tasks such as file organizer, cryptocurrency notifier, file renamer & more.

File organizer:

Moves files into their preferred location based on filetype

for mv in move_file:
    if mv.endswith(('.png', '.jpg', '.jpeg', '.gif', '.ico', '.svg')):
        shutil.move(mv, images)
    if mv.endswith(('.mp3', '.wav', '.mid', '.midi', '.ogg')):
        shutil.move(mv, audio)
    if mv.endswith(('.pdf', '.doc', '.docx', '.docxml')):
        shutil.move(mv, docs)
    if mv.endswith(('.txt', '.text', '.note', '.rtf')):
        shutil.move(mv, texts)
    if mv.endswith(('.mp4', '.avi', '.mov', '.vmw', '.flv', '.mpeg', '.mpg')):
        shutil.move(mv, videos)
    if mv.endswith(('.zip', '.rar', '.tar', '.7z', '.pkg')):
        shutil.move(mv, compressed_files)
Enter fullscreen mode Exit fullscreen mode

Cryptocurrency notifier:

Sends a notification when LiteCoin price changes (built using ifttt app)
Yes, it works with which ever cryptocurrency you wish to use.

while True:
        price = latest_price()
        date =
        lc.append({'date': date, 'price': price})

        if len(lc) == 3:
            ifttt_hook('applet_name', format_lc(lc))

        lc = []

Enter fullscreen mode Exit fullscreen mode

file renamer:

I only had a title and num, but change it to which ever way your file is formatted.

for files in os.listdir():
    file, extension = os.path.splitext(files)
    title, num = file.split('-')
    title = title.strip()
    num = num.strip()[0:].zfill(3)

    rename_file = '{}-{}{}'.format(num, title, extension)
Enter fullscreen mode Exit fullscreen mode

Feedback is highly appreciated!

Top comments (2)

codemouse92 profile image
Jason C. McDonald

Welcome to DEV!

endormi profile image