I tried this:
userVideosDirectory = Directory.GetParent(Environment.GetFolderPath
(Environment.SpecialFolder.ApplicationData)).FullName + "\\Videos";
But that give me:
C:\Users\username\AppData\Videos
But I don't have the directory AppData there only:
C:\Users\username\Videos
How do I get the Videos directory without the AppData ?
You can get the videos folder using Environment.SpecialFolders.MyVideos
property, and get the actual path to it using the Environment.GetFolderPath
method.
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
Note that that enum
contains many more folders you can get.
Have you tried this?
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
Something like that:
int userVideosDirectory = (Directory.GetParent(Environment.GetFolderPath
(Environment.SpecialFolder.ApplicationData)).FullName + "\\Videos").IndexOf(@"\AppData\");
if (userVideosDirectory != 0)
{
string str = (Directory.GetParent(Environment.GetFolderPath
(Environment.SpecialFolder.ApplicationData)).FullName + "\\Videos").Remove(userVideosDirectory, @"\AppData".Length);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With