Jump to content

Google Drive Messed Up My Workflows


Recommended Posts

Short story, I backed up my Alfred workflows in my google drive, and now when I try to download them, they all come in form of zipped files. I've read here that you can convert the .alfredworkflow.zip file back into an .alfredworkflow file which I've managed to do but when I try to install the workflow, none of the workflows have their respective pictures saved (if I tried to do this manually for ~ 40 - 50 workflows, it would take ages). Any thoughts on how to easily fix this / automate this? I've tried writing a Python script but even using the subprocess module to run bash commands messes up the workflow when trying to zip the info.plist file. I'd greatly appreciate any thoughts on this and any ideas! Even after doing this and I try to install through info.alfredworkflow, it complains and gives a message "The workflow you are trying to import is invalid."

I'm honestly not sure what to do at this point.

 

import os
import subprocess

# SINGLE
os.chdir("...") # change to directory that contains the .alfredworkflow.zip files
for f in os.listdir(os.getcwd()):
    if len(f.split(".alfredworkflow.zip")) == 2:
        path = os.getcwd() + "/" + f
        subprocess.run(["unzip", path, "-d", os.getcwd() + "/" + f.split(".zip")[0]])

dirs = list(filter(os.path.isdir, os.listdir(os.getcwd())))

# ZIP
for folder in dirs:
    if len(folder.split(".alfredworkflow")) == 2:
        path = os.getcwd() + "/" + folder + "/info.plist"
        subprocess.run(["zip", path + ".zip", path])

# RENAME
for folder in dirs:
    if len(folder.split(".alfredworkflow")) == 2:
        path = os.getcwd() + "/" + folder + "/info.plist.zip"
        subprocess.run(["mv", path, os.getcwd() + "/" + folder + "/info.alfredworkflow"])

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...