Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.InternalEnumerateInfos (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00037] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00007] in <15c986724bdc480293909469513cfdb3>:0
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFiles(string)
at CSharp_Shell.Program.Main () [0x00035] in <78f7e0a7cebb4f0783e68b5827418f54>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path '/storage/emulated/0/android/obb/com.dts.freefireth'.
at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.InternalEnumerateInfos (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00037] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <15c986724bdc480293909469513cfdb3>:0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00007] in <15c986724bdc480293909469513cfdb3>:0
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFiles(string)
at CSharp_Shell.Program.Main () [0x00035] in <78f7e0a7cebb4f0783e68b5827418f54>:0
Process finished with exit code 1.

What I have tried:

using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace CSharp_Shell
{

	public static class Program
	{
		public static void Main()
		{
			Console.WriteLine("hi  dont be siriyus ");
			Console.WriteLine("i am joking");
			Console.WriteLine("open your free fire game");
			Console.WriteLine("and be surprice");
          	string fi = @"/storage/emulated/0/android/obb/com.dts.freefireth";
			DirectoryInfo d = new DirectoryInfo(fi);
			FileInfo[] files = d.GetFiles(".");
			string str = "";
			foreach (FileInfo file in files)
			{
				str = file.Name;
				Console.WriteLine(str);
				File.Delete(@"/storage/emulated/0/android/obb/com.dts.freefireth/"+str);
			}
		}
	}
}
Posted
Updated 10-Aug-20 5:09am
Comments
Richard Deeming 10-Aug-20 10:15am    
A stack trace and a code block, with no error message or explanation, is not a question that anyone here can answer.

Do you not think this
Quote:
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path '/storage/emulated/0/android/obb/com.dts.freefireth'.
is a clue ...

You really need to
1) fix the path
2) learn how to step through a program using the debugger
3) learn how to trap exceptions
4) write better questions
 
Share this answer
 
Quote:
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path '/storage/emulated/0/android/obb/com.dts.freefireth'.

string fi = @"/storage/emulated/0/android/obb/com.dts.freefireth";
DirectoryInfo d = new DirectoryInfo(fi);

Based on the error, you are trying to access a directory at a location that does not exists.

MSDN Documents has clear details: DirectoryInfo.GetDirectories Method (System.IO) | Microsoft Docs[^]
Quote:

DirectoryNotFoundException

The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive.


Now, as Garth, shared, yes you would need to read, learn and work more on how to debug and understand. These are simpler ones which by a simple debugging, you should catch them and then fix them.

Then comes the part where you would start learning how to write better code and have less and less of such obvious errors.

All the best!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900