Move files in a folder based on the name

Hi,

I need to move files from a specific folder that contains a date (e.g. xxx_YYYYMMDD.pdf) in new folder named YYYY. I have tried For each activity, i.e. for each file in Directory.GetFile(“path”), however, I am still getting an error that array cannot be converted into integer.

Can somebody advice?

Thank you very much in advance!

Tereza

can you share code that is throwing error if you can?
Basically you need to do directory.getFiles(“Path”) Not file.

I am receiving error message that “value of type String cannot be converted into 1-dimensional array of string”

image

Can you please give me some example or printscreen? I did this and it still not working properly…thank you so much

Yep , Please find attached . Main.xaml (7.2 KB)

Thank you very much for your advice.

Now I have another problem - I need to select the files containing year. I have used substring to get the last characters of the files name and now I need to add if activity to select only the items in format YYYY (e.g. 2018, 2019). However, the function IsNumeric is not possible to be used for string variables…can please advice?

Again, thank you so much!

You can mark above as solution if that solved your problem. For date problem you can use Regex.IsMatch(your string , regex expression for year) = true .