• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spliting a file name  RSS feed

 
David McCombs
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a program that that reads a file of .gif images and stores them. It has worked well, until lately, a file called Thumbs.db gets read in, even through Windows explorer can not find it, even with searching hidden files as well. Does anyone know what this file is and how to delete it completely, and keep it from rearing its ugly head?

This got me thinking, people can add in their own images, but they must be transparent .gif files or it will look weird. So I tried to split the file name between the . and compare the extension.

String[] spl = str.split("\\.") returns the entire string. Just using "." because it is a predefined regex expression, so how do I split a string like this?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, str.split("\\.") should do it. If it's not working for you, it's possible that either the input does not actually have a . in it, or that you're not reading the contents of spl correctly. Here's a short demo:
 
David McCombs
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought it should work but am mystified why it doesn't.

The file names all have a . in them ie fish1.gif. fish2.gif, Thumbs.db,etc

I will go through it again, must be something that is subtle.

Thank you for confirming that I had the split argument correct.
 
Paul Clapham
Sheriff
Posts: 22506
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thumbs.db? That's just a file that Windows puts in a directory with lots of pictures if you open Windows Explorer and display the directory in "thumbnail" mode. I don't know what it's for but it's obviously something to do with the images. To delete it, just click on it and press the delete key just like any other file.
 
David McCombs
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would but it doesn't show up in Windows Explorer, even though it is set to list all files, even hidden ones. I got the split problem worked out so my program doesn't try to read it as an Image.
 
Han You
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thumbs.db is not viewable even when the "Show hidden files and folders" option is selected in the "Folder Options" dialogue box. To be able to view it, you have to unselect the "Hide protected opertaing system files (Recommended)" that is selected by default.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!