Question

Hashtag # in file name

  • 24 April 2023
  • 3 replies
  • 159 views

Badge +3

Hi Team,

I have issue with # character in the filename. My robot needs to download files from a webpage and I can’t influence file name, files are automatically downloaded to the Downloads folder. 

Some of the downloaded files contain # character in the name, for example “INV-00001943_#_Items.zip”

When I try to do any action with the file, for example rename, delete or unzip, I’m getting error that file doesn’t exist and in the error message name is shown only until # (file used in the example was “INV-00001943_#_Items.zip”) . 

Below you can see code I’m trying to run and error that I’m getting ($FileName$ = $Folderpath$\$FilesInFolder{name}$.$FilesInFolder{extension}$)

 

Do you have any solution how can I delete such files? 

 

Thank you!

Kasia

 

 


3 replies

Badge +4

Hi Kasia

 

Can you try to create a file with ‘#’ in the name (a new .txt file for example) and delete it in a separate code file? If that also gives you an error, it may be worth checking the release notes for your Automation Anywhere control room version as it could be a bug.

I have tried this with control room version .28 and I do not get an error.

 

In the meantime, if you’re using google chrome to download the file from the webpage, you could change the google chrome setting to always ask you for file path for saving the file:
 

Google chrome download settings

That way you'll have control over any nasty characters in your filename generated by your webpage.

 

Thanks

Badge +2

@Kasia 8214  if you want to delete all the files in that folder you can use this line inside delete file action.

$Folderpath$\*

 

 

Badge +3

Hi @AWilson, thank you for your suggestion, I tried creating a file with # in the name: “testfile_#_123.txt” and file that has been created has name “testfile_.txt”, so indeed it looks like a bug. I don’t want to change chrome settings, as we have multiple bots running on the same machine in production and it may affect how they work. 

@karthik CN, thank you for good tip, however I don’t want to delete all the files, my bot needs to work on some and some delete. Currently it can’t do any of these actions. 

I think I will end up using VBS or python script for it. 

Thank you for your help! 

Reply