Wait for Download Activity dynamic Monitored path

I have a wait for download activity in which the monitored folder path looks like this :

“C:\Users\User\Downloads”

Now When I perform the operation it works fine in my PC. But what if I want to run this into other computers then it will not work their PC’s will have some different download path.

“C:\Users*User*\Downloads”

Is there a way by which I can make this section which is in the star mark dynamic ?. Because in my PC the User name is User so it works but in other cases it will be like :

“C:\Users\ABC\Downloads”

Is there any way around for this ?

Hi @Ishan_Shelke1

Try to use this expression

Environment.CurrentDirectory

Regards
Gokul

Hi @Ishan_Shelke1 ,

You don’t have to add any wildcards, try this snippet of code.
It will autogenerate the DownloadPath for you.

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads"

Kind Regards,
Ashwin A.K

1 Like

This Worked Great. Can You just explain this little snippet of Code ?

Hi @Ishan_Shelke1 ,

The innercode retrieves a UserProfile Object which contains your user’s current directory →

Environment.SpecialFolder.UserProfile

And the outer code parses the object to retrieve the Folder Path from it →

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)

And we add a /Downloads to navigate to that particular directory →

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads"

image

Kind Regards,
Ashwin A.K

excellent explanation thanks.

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