Questions tagged [directoryinfo]
The .NET DirectoryInfo object contains detailed information about a directory on the filesystem.
229
questions
0
votes
0
answers
14
views
DirectoryInfo on Simulated file system
I realy like DirectoryInfo class that C# provides
I use it to create, delete, list files like this
using System.io;
static class Program
{
/// <summary>
/// The main entry point for the ...
2
votes
2
answers
66
views
Why doesn't Powershell System.IO.DirectoryInfo with UNC paths work as expected?
I'm seeing some inconsistent behaviour in PowerShell Core 7.3 with variables of type [System.IO.DirectoryInfo] - the following works as expected:
$dir = [System.IO.DirectoryInfo]'c:\deploy'
$dir....
1
vote
1
answer
88
views
How to efficiently retrieve a list of file names and lengths
I have a C# application where at one point it scans a folder that could potentially contain 10s of thousands of files. It the filters that list by name and length and selects a relatively small number ...
0
votes
1
answer
214
views
How to get DirectoryInfo and/or FileInfo of specifiek directories?
For an exercise I have to put the path of all the directories on my I:\ disk, the amount of files in those directories (and in their subfolders) and the size of the directory
in a CSV-file.
I've been ...
0
votes
1
answer
68
views
Search and return path of given folder name (Windows and Linux)
I want to get the path of an existing folder SeleniumTestData inside the solution.
Why? My selenium tests should create at start of the test, temporary folder which are being ignored in Git, so each ...
0
votes
4
answers
60
views
How to get the first created folder instead the last?
var lastWrittenFolder = new DirectoryInfo(textBoxPath.Text).GetDirectories()
.OrderByDescending(d => d.LastWriteTimeUtc).First();
this is working fine for getting the latest ...
0
votes
2
answers
414
views
C# DirectoryInfo FullName and FullPath can't handle trailing spaces, how to fix?
string directorypath = @"C:\Folder01\Subfolder01\Next_level_Down ";
DirectoryInfo mydirectoryinfo = new DirectoryInfo(directorypath);
When the above code is run mydirectoryinfo.FullName ...
0
votes
2
answers
229
views
C# get folderpath from TreeListNode in treeList devexpress
I use XtratreeList with fileExplorerAssistant. I have a problem when I want to get the path of the selected folder from treelist. Or I have a problem in getting the folder path from TreeListNode. ...
1
vote
1
answer
83
views
Determine C# code class file's parent directory path at design-time
Here is info about our technical development environment :
• .NET Core 3.1
• PostgreSQL 14.2, compiled by Visual C++ build 1914, 64-bit
• EntityFramework.Functions Version=1.5.0
• Microsoft....
1
vote
0
answers
78
views
StackOverFlowException raised when this line such as "logDirectory = new DirectoryInfo(m_logFileDirectory);" was excuting
StackOverFlowExceprion raised, when logDirectory = new DirectoryInfo(m_logFileDirectory); line was executing. How can I solve the problem? Please help me.
This procedure writeLogToFile write a ...
1
vote
4
answers
621
views
Finding if an item in a directory is file or folder using C#?
I want to check if each item in a directory is of type file or a folder in using C#. I want to write something like the code below. But IsInstanceOfType(FileInfo)and IsInstanceOfType(DirectoryInfo) is ...
0
votes
0
answers
79
views
Powershell Replace Method Stopped Working For This Loop
The replace method worked in this code for two years, why did it stop? Am I missing an update? Did a security update kill it? I just want to know if it's me, or if by some fluke it worked to begin ...
2
votes
2
answers
134
views
Filter an ObservableCollection of DirectoryInfo with LINQ
I'm using MVVM to populate a TreeView with a DirectoryInfo and all its sub-directories and files.
I then want to search through the treeview with LINQ .where() but I'm only searching the top ...
0
votes
1
answer
349
views
GetFiles is incredibly slow vb.NET
I need to process a large amount of files and scour thru a group of directories and subdirectories and get the file from the found directory. This is easy using a simple directory but when scouring a ...
0
votes
1
answer
955
views
Can I maintain directory structure when zipping file?
I'm attempting to zip up a handful of files but these files could exist in different directories. The zipping portion is working correctly but I cannot figure out how to get it to preserve the ...