GeekSmack Community: [C#] File Permissions - GeekSmack Community

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[C#] File Permissions

#1 User is offline   Lander 

  • Member
  • Pip
  • Group: Member
  • Posts: 10
  • Joined: 17-May 09

Posted 13 March 2010 - 01:23 AM

Hey everyone, it's been a while.

Seeing as though this is probably one of the only sites where I'll get some straight answers, I decided to bring this here.


The Problem:

What this program I'm working on does is it recursively checks folders within a selected directory for files with a specific file header (so yeah, I open the file with EndianIO, read the first 4 bytes, etc.), so whenever I hit a file I can't access - that's fine, the loop keeps on going, but whenever I hit a DIRECTORY I can't seem to access... that breaks the entire operation.

The Goal:

Make it so that when it hits an inaccessible directory, it doesn't break the operation.

Since I really haven't worked with directories or directory attributes before, would anyone have any ideas?

Error example:

Attached File  error1.PNG (63.92K)
Number of downloads: 14


Code I'm working with:

try
    {
        string[] folderlist = System.IO.Directory.GetDirectories(KidCuDi, "*", System.IO.SearchOption.AllDirectories);
        ListViewItem lvi;
        ListViewItem.ListViewSubItem lvsi;
        foreach (string yeah in Directory.GetDirectories(KidCuDi))
        {
            DirectoryInfo yee = new DirectoryInfo(yeah);
            foreach (FileInfo file2 in yee.GetFiles())
            {

*rest of my code goes in here*


Help is appreciated, thanks in advanced.

Edit: It doesn't break each time it reaches an inaccessible file, it breaks after 7 errors are thrown (there are two voids going on, one gets the files from the directory chosen, the other gets the files within each subdirectory)
Posted Image
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


This page is sponsored by TopHostingCenter.com, a web hosting provider that specializes in cloud hosting.

As well as Hosted Exchange