How to check if a file exist inside a folder and then get the filename for that specific file and move the file to another folder


#1

Hi all,

Let me explain the situation:

I need to search for a file name in a folder where are many different files. For example a file like this:
“All Data Export_1_spend_3_2018” Find that specific file and than move that specific file to a different folder. The problem is that the file changes name every month AND every year (when I download the file): For April will be: All Data Export_1_spend_4_2018. If we are in 2019 will be
“All Data Export_1_spend_3_2019”.

Can somebody please help with this?

Thank you


Check if a folder is present in a directory or not
#2

Hi @Prog,

You can check using if condition
path.Exists("full path")

True-> file exists.
False-> file not exists

Move file activity to move the file from one folder to another folder


#3

Few file search patterns:

Current Month

String file=Directory.GetFiles("filepath",“All Data Export_1_spend_"+now.Month.ToString+"_"+now.Year.ToString+".xlsx").First

All 2018

Array Files= Directory.GetFiles("filepath",“All Data Export_1_spend_*_"+now.Year.ToString+".xlsx")


#4

Thank you very helpful!!