Thumbs.db issue

I have a folder where i get thumbs.db always (its not seen even when hidden files are seen). I am having a scenario on checking the folder and select all files to upload in to some portal.

In normal cases, my code works fine. At very rare scenario - When there is no files in that folder, Selection wont work. I tried to put a condition on getting the folder( getfiles) length.size and if its 0 – skip the flow, if its >0 process the file upload.

But, when the bot checks that – IT goes to upload still (as the length size is returning 1 because of Thumbs.db file). Any suggestion on how to handle this situation? I can go for nested if to solve this, but i wanted to know the right way to handle this.

Thanks,
KK

I think solution is very simple, thumbs.db always exists, hence change the condition to
folder.length > 1, it should work

1 Like

Or get the filenames and check for the extensions. If the file extension contains “.db” do not upload the file. You can always be sure that what you are uploading is the correct file types then.

1 Like

i tried that too! what if the real time files come and the thumbs.db doesnt exist that time?

Thanks Cotly. but,Right now, i did that way only… did a IF condition… and if the file lenght is more than 1 - i iterate it and check for the “ends with .db” and pass the normal flow in the else condition… But i felt the code is like little nested. So thought to check if there is any other simple methods which am not aware (which is in buit in uiPath).

You said - “I have a folder where i get thumbs.db always”

Thats right! As you know Thumbs.db is a cache file… when there will be a clean up, there will be always a situation that for the first run thumbs.db wont be there until that get created. Also, i am looking for a possible solution where the code shouldnt care about the Thumbs.db.