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??
Does all the files stored in the specific folder or anywhere in the system?
read file that same folder project uipath
It can be in the specific folder as well anywhere in the system
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.
wht if its present anywhere in the system?
In my scenario it can be present anywhere in the system.
Please help…its urgent
In my case it can be anywhere in the system
You can loop through all the logicaldrives (
C:\ D:\....) using DriveInfo.GetDrives to check if the file exists or not in that drive.
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
Note: Not sure about other best and concise solutions. Let’s wait for others as well.
can you please provide it in the form of xaml.Its bit urgent
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.”)
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.
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
nope…can u pls share it as workflow on how to use it
Below is the error i got :
For each : The device is not ready.\r\n