UiPath- How to fetch a name of the file without extensions?

ray sha
4 min readSep 29, 2020

--

INPUT

Input: Any file (docx, txt, xml, xlsx)

I’ve used an excel (.xlsx) file

Name: file1.xlsx

Adding a screenshot of the XML file.

OUTPUT

Output: Using Message box to display the output.

Getting the file name without extension

Name: file1

Adding a screenshot of the XML file.

FLOW

To achieve the desired output, please follow the below steps:

1. Open UiPath Studio. Select “Process.”

2. Create a new process by entering a valid name and change the description to something meaningful. Location must be the path where you want to save the process.

3. From the activities panel, select a sequence or a flowchart. I’m starting with a sequence. Rename the sequence to something meaning. Add annotations.

4. In the sequence use a “Assign” activity. The properties of this activity are

To: files

Value:System.IO.Directory.GetFiles(“{Path till the directory where the file is present}”)

Where,

files is the new variable created

Data Type/Variable Type of files: Array of strings

5. Use another “Assign” activity

To: only_FileName

Value: Path.GetFileNameWithoutExtension(file(0))

Where,

only_FileName is the new variable.

Data Type/Variable Type of only_FileName: Strings.

6. After this use a message box activity to display the output

7. A snippet of the variable panel

8. The whole flow is shown below:

I really hope this solves your doubt. Feel free to reach out to me for any further queries.

Always remember to be kind.

All the best and Happy learning!

--

--

ray sha
ray sha

Written by ray sha

An effort towards making myself happy!

No responses yet