Hi,
How can I pull folder names from a directory? I do not want the subfolders or files names
I also want the folder names even if they do not contain a file.
Thanks.
@wonka1234 I think I got it now! Just insert your link into the Text Input file (replace the current one). Press 'Run'. Click on the output anchor 1, all folders should be displayed even if they are empty! This doesn't contain the subdirectory folders though. Just all folders within the current folder.
Do you have a script to perform this? because I tried but seems the host can't connect this way when a directory is outlined. Can you attach an example workflow of this working?
@BS_THE_ANALYST very nice
Have you checked my solution? You have to run as an App and provide path.
@wonka1234 code is underneath the picture below. Hopefully it works for you. Just copy as paste it in the Jupter Notebook.
from ayx import Package
#Package.installPackages(['pandas','numpy'])
from ayx import Alteryx
import os
import numpy as np
import pandas as pd
var1 = Alteryx.read("#1")
a = var1.iloc[0,0]
link = a.replace("\\","/")
link
# # Get list of folders in file path
folder_list = os.listdir(link)
[folder for folder in folder_list if folder.find(".") == -1 ]
df = pd.DataFrame(data = [folder for folder in folder_list if folder.find(".") == -1 ], columns=["Folders"])
Alteryx.write(df, 1)