I’m new to Ui Path and created my first workflow. But I’m having some problems, I hope you can help me with this.
Here is what the worklfow is supposed to do:
- the application must open a folder in which there are a dozen or so more folders.
- then a for each loop goes through each folder and searches for the newest xlsx file in each folder. (except 2 of these folders! Searchoption must exclude these: folder1 and folder2)
- if it finds a new file, it must take the first 3 letters of the file name. (for example the TRS of TRS_currentfolder_Date.xlsx) and rename it to "Newfolder_TRS.xlsx and move all the files to the new folder (a collective folder).
so far I came across 2 problems:
I don’t really know which static method I should use for the assign action at the beginning of the workflow to search for the newest file in each folder. as of now my workflow can only search for every file in each folder. I tried the method "Directories.GetDirectories(path, “*.xlsx”,SearchOption.AllDirectories).Where(function(s) NOT s.function(“folder1”, “folder2”)) but it doesn’t work, also it can’t search for folders with newest filles. there is another method I know about the “NewDirectoryInfo.Getfiles” method, but it doesn’t work with the rest of the string types. it only works with Directory and Fileinfo types which can’t be converted into string according to Ui path.
At the end of the workflow there is a problem with the assign action: name=filename.Split("_").
it says “Open strict on doesn’t allow implicit conversions from string to char.”
here is the link to my workflow. PW: Excel
Thanks a lot!