Solved

# Count files in directory in windows phone 8

Posted on 2014-01-10
229 Views
I need linq snippet for count files in directory.
0
Question by:amatic
• 2
• 2

LVL 74

Accepted Solution

käµfm³d   👽 earned 500 total points
ID: 39770866
Based on what I see in the documentation, you should be able to use either the Directory class or DirectoryInfo class to determine this.

e.g.

DirectoryInfo dir = new DirectoryInfo(@"path\to\folder");
int fileCount = dir.GetFiles().Length;

// OR

fileCount = Directory.GetFiles(@"path\to\folder").Length;


There's no perceived benefit from using LINQ to get this information as you'd have to involve these classes anyway.
0

Author Comment

ID: 39770870
Are you sure that will working on Windows Phone???
0

Author Comment

ID: 39770873
How to get directory path on Windows Phone??
0

LVL 74

Expert Comment

ID: 39770879
I have to confess that I haven't (yet) written anything for Windows Phone, so I can only go by the documentation:

0

## Featured Post

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.