Move File (ignore parent folders)

Hello UiPath Masters,

Does anyone know if the following is possible for uipath robot?

I am downloading a .zip from a webpage and then unzipping to a certain folder. The problem is the files that I am unzipping often are unzipped as files with parent folders (e.g Folder1>file.pdf. Folder2>file.csv)

I am trying to have the bot retrieve the files only and not the folders and put them into another folder. This is to have all files that were downloaded in one folder instead of folders within folders (does that make sense?). Does anyone know how to do this?

Use this static function ```
Directory.GetFiles(path, “*.pdf”, SearchOption.AllDirectories)
this will return all String of pdfs files paths from parent as well as sub directories
later loop each file path from string to move

1 Like

Thanks Aabdur - but I am getting an empty string back






Here, GetFileName variable should be of type Array of string and you are trying to print the same. That’s why it’s printing like this.

Iterate that array print one by one item.

           ForEach item in GetFileName
                   Print item

I have it working now - Does anyone know what I should do if I want to include all files not just .pdf? I will have .xls and .word docs I want to move also

Thank You!

Just use Directory.GetFiles(FolderPath)