How to convert normal path to environmental path

I have a path like this and I want to convert this into an environmental path

Directory.GetFiles(“C:\Users\sathishpc\Downloads\reports”+DateTime.Now.AddDays(0).ToString(“dd.MM.yy”)+" 01\csv",“*.csv”)

Hi @sathish_Kumar6

Can you try the below syntax:

Directory.GetFiles(Path.Combine("C:\Users\sathishpc\Downloads\reports", DateTime.Now.AddDays(0).ToString("dd.MM.yy") + " 01", "csv"), "*.csv")

Regards

1 Like

not like this i want using like this example: Directory.GetFiles(Environment.ExpandEnvironmentVariables("%USERPROFILE%\Downloads\reports"), “*.csv”)

Hi @sathish_Kumar6

Can you try this once:

Directory.GetFiles(Environment.ExpandEnvironmentVariables("%USERPROFILE%\Downloads\reports"), "*.csv")

Regards

1 Like

Directory.GetFiles(Environment.ExpandEnvironmentVariables(“%USERPROFILE%\Downloads\reports”+DateTime.Now.AddDays(0).ToString(“dd.MM.yy”)+" 01\csv"), “*.csv”)

this one worked thanks for your reply

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.