Can't read the document with a "File" type of file

To those concern;

I get this error because the file could not be found. I was wondering why the type of file is “File”.
image
What I did was I used the Assign activity to read the files in the Download folder.


Exhibit3

I saved that file directly from a web. It says in the Save as type as “Text Document” but when I look for it in it’s path folder, the type of file turned out to be a “File” type and not .txt file.


Do I need to put the “.File” in the filename?

My problem is how to read that “File” extension so I could go on with the Assign activity?
Thank you.

try replace .File with .txt

Hi @jharmel.carmona ,

  1. You can declare the variable filename =path.GetFileName(file.ToString). This will return the filename instead of full file path.
  2. in for each loop you can get the file extensions by declaring a variable Path_extension= path.GetExtension(filename) , and then print out each file extension value, here you can check each file extension.
    3.After getting to know each file’s extension you can pass the same extension in your code.

Thanks & Regards,
Shubham Dutta

None UiPath suggestion:

Turn on the check box in Windows for “File name extension” so you can actually see what the file extension is. If a file does not have any extension Windows marks its type as “File” (see image below)
image

So if you’re using an extension of .txt or .file when you call the file, it will fail because it doesn’t exit.

Also, I noticed a space was missing in your example after the date… before the name.

That may be the cause of the error in this case.

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