473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I tried to use getfiles("*.jpeg) to get all the jpeg files form the dir. its not work

Expand|Select|Wrap|Line Numbers
  1. string path = "c:\\jpeg";
  2.  
  3.             long fileSize=0;
  4.  
  5.             DirectoryInfo dir = new DirectoryInfo(path);
  6.  
  7.             FileInfo[] fi = dir.GetFiles("*.jpeg");
  8.  
  9.  
  10.  
  11.             foreach (FileInfo jpegfile in fi)
  12.             {
  13.                 fileSize += fi.Length;
  14.  
  15.             }
  16.  
  17.             MessageBox.Show("Size of JPEG file is:" + fileSize);
Jan 7 '11 #1
3 1585
Change *.jpeg to *.jpg
Jan 7 '11 #2
HaLo2FrEeEk
404 256MB
JPEG-format files are (VERY) rarely saved with an actual .jpeg extension, it's usually the shorter, abbreviated .jpg. Subin's reply is exactly what you need to do, mine is simply to tell you why, so you learn why it didn't work.
Jan 7 '11 #3
Curtis Rutland
3,256 Expert 2GB
The best solution is to search for both.

Expand|Select|Wrap|Line Numbers
  1. FileInfo[] jpgs = di.GetFiles("*.jpg");
  2. FileInfo[] jpegs = di.GetFiles("*.jpeg");
  3. FileInfo[] allFiles = jpgs.Concat(jpegs).ToArray();
Jan 7 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
by: Julia | last post by:
I have a page that the user will use multiple times. When they submit the form, it sends me the info, and redisplays the form for the user to use again. I have one field in there that I'd like...
1
by: J | last post by:
Hi, Ive got 3 forms, (a subform within a subform within a form) and when I refresh the outermost form, Access closes and offers to send an error report. The forms worked fine a few weeks ago,...
5
by: Dave | last post by:
How do I check in a Windows Forms app if any controls have changed? I have a form that collects data, and I want to prompt the user if they try to exit the app, or load a new file, without saving...
4
by: Hrvoje Vrbanc | last post by:
Hello all! I have a small problem: I have an ASP.NET page that displays content of a folder in a DataGrid (more precisely, it displays Name, Lenth and CreationDate of the files). Default sort...
15
by: Billy | last post by:
Anyone know if this a bug in VB.NET 2002 and how to overcame that situation? I have a MDI form from where I call MDI child form like that: Dim frm As New frmChild() frm.MdiParent = Me...
4
by: Greg | last post by:
I've searched everywhere for a solution Microsoft .NET Framework V 2.0.50727 AutoEventWireup="false" image2.aspx resize an image on the fly but Page_Load is triggered twice: Any suggestion?...
3
by: Chuck W1CEW | last post by:
Hi there! I'm using the Apache .htaccess directive for a PHP autoappend, eg: php_value auto_append_file /usr/www/users/myusername/includes/ footer.html Works great. However, I'm trying to...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
5
by: programmerboy | last post by:
I never had this kind of issue before and it is completely surprising. I have a usercontrol where I need 2 forms to make 1 form. When I have only 1 form it submits the page to itself. I have spent...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.