Copy File Activity - Path.Combine appending forward slash to the file path

Hello,

I’m trying to save a file downloaded from Google Drive (I am not sure if this is the right way to do it? But that’s another discussion).
Why does Path.Combine append forward slashes to the file path? Please see error message here, and the corresponding activity configuration below that:

image

The expression configured in the activity is:

Path.Combine("C:\Users\Public\Documents\StudioWebArea\MyGoogleDrive_Files",GDrive_DownloadedFile.GetName()+"."+GDrive_DownloadedFile.GetExtension())

Thanks

Can you please share what do you try to achieve? Where do you want to save it? Are you running the automation in StudioWeb? Where do you expect to end up with the file?

The “/” from path combine is originating the OS of the robot executing your workflow.

I am trying to download a file from my Drive down to my local machine.
Subsequent to my first attempt where I ran into the “/” issue, I’ve changed the activity configuration and posted the steps in response to @loginerror .

I am still running it in StudioW, but plan to deploy and run it from Assistant like I have done with all others.

Finally, I want to save file to this location: C:\Users\Public\Documents\Somefolder\filename.png

thanks,
Andy

Should this really matter? Goes back to my original question. Why would it want to do that? I am asking for the filename only. The forward (or backward) slash must not be part of the output.

thanks

This is how Path.Combine works. You can see in my example, as “/” is the standard separator for UNIX, it will be used. I have used Path.Combine(“C:\MyFolder”,“test.jpg”) and “/” is appended between the 2 args.

My recommendation is to use forward slashes as it will be accepted in Windows also (starting Windows 7 if I recall correctly).

Thanks for you help @alexandru .

I have posted an update here.

And, the failure of Path.Combine in the immediate next thread here

Cheers,
Andy

1 Like