How to get the internal memory root path?

Hello there,

I would like to know how to get the path? e.g to get the Download folder path I used:

Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath;

I need to get the path for the hello file.

Would you mind to help me?

Thanks in advance.

Best Answers

  • AtanasAngelovAtanasAngelov ✭✭✭
    Accepted Answer

    Another way that you can access those files and the txt file that you want to get is by following this method.

    the first line of code is my path to memory of the phone while the next line is by connection, you can simple do "Android.OS.Environment.ExternalStorageDirectory.ToString() + "/hello.txt"" in order for you to access that file, additionally you can do the same thing with files showed above :P

  • AtanasAngelovAtanasAngelov ✭✭✭
    Accepted Answer

    A way that you can rename an already existing file is by using "System.IO.File.Move("oldfilename", "newfilename")", after a quick research, this allows you to do that.
    You can refer to this link for some examples and explanations on some ways to handle the situation :P

Answers

  • AtanasAngelovAtanasAngelov Member ✭✭✭
    Accepted Answer

    Another way that you can access those files and the txt file that you want to get is by following this method.

    the first line of code is my path to memory of the phone while the next line is by connection, you can simple do "Android.OS.Environment.ExternalStorageDirectory.ToString() + "/hello.txt"" in order for you to access that file, additionally you can do the same thing with files showed above :P

  • NotCoconutNotCoconut Member ✭✭

    @AtanasAngelov Thank you very much!!! it works :smiley: I used:
    string internalroot = Android.OS.Environment.ExternalStorageDirectory.ToString();
    string file = internalroot + "/hello.txt"

    //to check it the file exists:
    if (File.Exists(ficheroStageGo))
    {
    Console.WriteLine("File exists");

            }
            else
            {
                Console.WriteLine("Nope");
            }
    

    By the way, How can I rename the file name?
    WOuld you mind to help me?

  • AtanasAngelovAtanasAngelov Member ✭✭✭
    Accepted Answer

    A way that you can rename an already existing file is by using "System.IO.File.Move("oldfilename", "newfilename")", after a quick research, this allows you to do that.
    You can refer to this link for some examples and explanations on some ways to handle the situation :P

  • NotCoconutNotCoconut Member ✭✭

    @AtanasAngelov Thank you very much!!!

Sign In or Register to comment.