Search for the File Name without giving Full Path


#1

Hii,
I have a textFile and i want my BOT to get the file by just the name.
User should not provide the full path.But when User is providing just the File name BOT is throwing an error.
e.g. in Input Dialog user gives just file name like “abc” so BOT should be able to open the File with the name “abc” stored in the computer. User should not give full path like “C:\Users\Desktop\abc.txt”.
Any way to resolve this??
@ddpadil @SaranyaKishore


#2

Hi,

Does all the files stored in the specific folder or anywhere in the system?


#3

read file that same folder project uipath

regards


#4

It can be in the specific folder as well anywhere in the system


#5

please elaborate


#6

As @Chinh_Le mentioned, if all the files are inside the same folder where the project is present, there is no need to get full path from the user. Only the file name is sufficient to open the file.


#7

wht if its present anywhere in the system?
In my scenario it can be present anywhere in the system.
Please help…its urgent
@SaranyaKishore


#8

In my case it can be anywhere in the system


#9

Any Suggestions???


#10

Hi Sowmya,

You can loop through all the logicaldrives (C:\ D:\....) using DriveInfo.GetDrives to check if the file exists or not in that drive.

Syntax :

Directory.GetFiles(driveName,FileName,SearchOption)

The above said has to be placed within a for each loop. But do remember that an access check\ device ready status (System.Io.Exception) has to be performed before making the search in the particular drive using Drive.IsReady.

Note: Not sure about other best and concise solutions. Let’s wait for others as well.


#11

can you please provide it in the form of xaml.Its bit urgent


#12

Hi,

If you are using latest version of UiPath studio then use invoke code activity and place this code inside that.

This code will check entire system for a specified file.

My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, “yourfilename.”)


#13

Hi,
In my option, in case search file in all folders, this action is very low.
And have case same name but not same path, how do u know this is your file u want?

I think u should focus to save file to predefined directory before read file.

regards


#14

hii,
my file name is of .txt and i want to change it in Excel.
So what i want is,
User will give the filename in Input Dialog ,BOT will search for the file in the system,Convert it into excel and if the file is not present it will throw an exception “File not found”
All this needs to be in Try Catch.
Any suggestions on this?
@sarathi125 @SaranyaKishore @Saurabh_Sahu


#15

@Manjuts90 pls check my this Query and help.


#16

@somya177 below code is not working for u


#17

nope…can u pls share it as workflow on how to use it


#18

@somya177 try below code, it may help u but i not sure.

Main.xaml (11.0 KB)


#19

Below is the error i got :
For each : The device is not ready.\r\n


#20

@somya177

I am not sure about this error