Home > Storage > PowerScale (Isilon) > Industry Solutions and Verticals > Media and Entertainment > PowerScale OneFS: A Metadata Driven Approach to On Demand Tiering > Query DataIQ to get all items below a particular directory
This code calls the pathfinder function above and prints the list of paths it returns. It queries the user to decide on which directory to operate. In this implementation, the administrator will only input the parent directory, not the full path. For example, if the full path is /ifs/data/project/myproject, the administrator only types myproject.
pathlist = pathfinder(tag_name, tag_value)
print("The following directories have the DataIQ tag:", tag_name, ":", tag_value)
for path in pathlist:
print(path)
dir_path = input("Which directory to set extended attributes on? ")
Once a directory has been chosen, the following code creates several lists. The first list, item_list contains all the files and directories that will have extended attributes applied. The DataIQ API call .enumeratePathsGenerator is the necessary call to query the DataIQ file index and returns the items beneath a particular path. The second list, paths_to_smartpoolstreejob contains the full “parent” paths onto which the File Policy rule will be applied. There is also a little logic in this block of code to decide which paths will get acted on and which will not.
item_list = []
paths_to_smartpoolstreejob = []
for path in pathlist:
current_path = pathlib.Path(path)
if current_path.name == dir_path:
paths_to_smartpoolstreejob.append(path)
print("The directory", path, "will get extended attributes:", tag_name, ":", tag_value)
for result in api.enumeratePathsGenerator(path, True):
item_list.append(result)
# print(result) # prints full results
else:
print("The directory", path, "will not get extended attributes")