Jump to content

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"])

 

Share this post


Link to post

We can’t tell you how Google Drive has messed up your workflows without seeing at least one of the messed-up workflows.

 

There are many things it might have done, including simply adding “.zip” to the filename (workflows are ZIP files, just with a different extension).

Share this post


Link to post

Wow, you were right. I just assumed that it was actually zipped since it was a .zip file. By just removing the .zip from the name of the file, that allowed for me to install it while keeping all of the images intact.

 

Thank you!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...