Skip to content

Folder name based on working directory #6330

Closed Answered by mikf
komoreshi asked this question in Q&A
Discussion options

You must be logged in to vote

You can access the current working directory with os.getcwd(). Using __import__ to get the os module and conditional format strings gets you

        "pixiv":
        {
            "directory":
            {
                "__import__('os').getcwd() == 'D:\\Downloads'": ["{category}"],
                "": ["{category}", "{user[id]}"]
            }
        }

Alternatively, you could use globals to make the os.getcwd() result available in a more readable way.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@komoreshi
Comment options

@mikf
Comment options

Answer selected by komoreshi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment