Sometimes bot retrieves incorrect file name

  • 22 January 2024
  • 9 replies
  • 110 views

Badge +2

HI guys, 

I use loop to get file name of each file that is present in the folder. 

Bot works good and is able to get correct file names, but sometimes it retrieves the file name with extension e.g.’ Downloads\FORECAST.020950.csv.csv' - for that I put if statement and extract name w/o extension if it is present

and sometimes it retrieves totally different name: ‘Downloads\886e099b-53f7-44c0-8383-0f7ed2b34472.csv' - but I am  not sure how to handle this and bot fails if incorrect file name is being retrieved.

Can anyone help here, please?

 

Thanks a lot

Eva

 


9 replies

Userlevel 6
Badge +15

Hi @EvaG ,

Please verify the all the files in the folders, might some files contains the .csv is filename itself. Thus, the above issue occurred. 

Which site are you using to download the file?

 

 

Badge +2

Hi @Tamil Arasu10 

Thank  you for reply.

I use customer web portal and while testing the bot I still download the same files over and over again.

I download the file, wait for file to be present in download folder, loop thru to get file name and then move the file to different folder. Sometimes the first file shows .csv included in the message box and sometimes for example the 25th file shows the csv included..so I do not think this is the matter of file name. Because when I rerun the bot then the first file is without csv and it is the same file.  And sometimes I get totally weird name as a mixture of letters and numbers. 

Userlevel 7
Badge +13

Hi @Tamil Arasu10 

Thank  you for reply.

I use customer web portal and while testing the bot I still download the same files over and over again.

I download the file, wait for file to be present in download folder, loop thru to get file name and then move the file to different folder. Sometimes the first file shows .csv included in the message box and sometimes for example the 25th file shows the csv included..so I do not think this is the matter of file name. Because when I rerun the bot then the first file is without csv and it is the same file.  And sometimes I get totally weird name as a mixture of letters and numbers. 

 

 

Hi @EvaG ,

 

Instead of going with this approach, why don't you download the Report to your desired folder itself?

If you are using Chrome, enable the below option. You can then pass your Folder location + The desired file name along with the extension by using a Variable.
 

 
Userlevel 6
Badge +15

Hi @EvaG ,

Once you have downloaded the files, please check the below options, 

  1. Open the downloaded location
  2. Click on View.
  3. Choose Show.
  4. Select File name extensions
  5. verify the all the files whether .csv is included or not.
 
Badge +2

Hi Padmakumar,

 

I know there is an such an option, but this will not solve my problem because anyway i need to retrieve the name of a file that I need for other subsequent tasks. 

Userlevel 7
Badge +13

Hi Padmakumar,

 

I know there is an such an option, but this will not solve my problem because anyway i need to retrieve the name of a file that I need for other subsequent tasks. 

 

Likewise, you can assign more convenient name to this file by using this method. I believe you are downloading and working with only one file throughout the process.  

 
Badge +2

@Padmakumar,

you are right, but the problem is that we have more bots. If I change the chrome settings for my bot I will probably harm the others when it will prompt for a file path, right? So I am trying to develop the bots with the same settings.

@Tamil Arasu10 the folder is showing files without extensions.. this is how it is being setup - but I already took care about the extension problem is when I am getting weird file names like 835f1fed-4ab1-4e33-8abf-208e3375ac45.csv 

Userlevel 7
Badge +13

@Padmakumar,

you are right, but the problem is that we have more bots. If I change the chrome settings for my bot I will probably harm the others when it will prompt for a file path, right? So I am trying to develop the bots with the same settings.

@Tamil Arasu10 the folder is showing files without extensions.. this is how it is being setup - but I already took care about the extension problem is when I am getting weird file names like 835f1fed-4ab1-4e33-8abf-208e3375ac45.csv 

 

Ok, it is completely up to you, but it is definitely not a hard thing to do as you are saying.

 

Have you turned on "Show hidden files” option? If yes, please disable it and check again.

 
Badge +2

HI @Padmakumar 

Thank you, the Show hidden files option was not turned on. I put if statement to catch incorrect name and then to refresh folder and try to capture name once again. Since then I haven’t had this issue but the truth is that I haven’t tested it that much.

Reply