Questions tagged [system.io.fileinfo]

77 questions
2
votes
3 answers

How do I return a list of my folders with the files inside?

I am wondering how can I return the list of my folders with the files inside. Because I can't return both of the list...and can't put both types in the list. public List GetTopFolders() { List Folders =…
Kiwimoisi
  • 4,086
  • 6
  • 33
  • 64
1
vote
2 answers

Searching By File Extensions VB.NET

Hi all i have been trying to search a specified directory and all sub directories for all files that have the specified file extension. However the inbuilt command is useless as it errors up and dies if you dont have access to a directory. So here's…
crackruckles
  • 336
  • 2
  • 5
  • 21
1
vote
1 answer

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.EntityFrameworkCore.Design Version=5.0.17 • …
crazyTech
  • 1,379
  • 3
  • 32
  • 67
1
vote
0 answers

System.IO.FileInfo.Equals() is not returning expected result in Where LINQ extension method

When attempting to return all other files from the same directory that a specified file resides in, the files being returned are including the specified file. Lets assume I have three files out in a server share on my…
1
vote
2 answers

Group Files into 500MB chunks

I have a List of files List files = GetFiles(); which has about 2 GB of files. Now I need to chunk these files into 500MB parts. In this case the result will be 4 List with the Sum of all Files is below 500MB. I have…
Impostor
  • 2,080
  • 22
  • 43
1
vote
2 answers

C# Using GetProperty for LINQ OrderBy using FileInfo

I am trying to use the Reflection GetProperty to set the type of OrderBy I want dynamically. The orderByParam would have a value such as "Length", "Name", "CreationTime", etc. This will allow me to add the files to a list in the order I want later…
1
vote
1 answer

c# Get File Last Access or Usuability

I need to inspect all files within a Repository periodically and compare its LastAccessTime in order to know when was the last time that file was used (accessed, modified and/or updated). I've already been tried with File.GetLastAccessTime() and…
Leonardo
  • 39
  • 1
  • 7
1
vote
1 answer

How to delete file from relative path in asp.net

My Debugging screenshot I am trying to delete a file in asp.net web 4.7.1. I'm using FileInfo and checking if file exists using a relative path the points to the Uploads folder and image full name and extension. I have saving the image path in my…
knowiz
  • 11
  • 2
1
vote
1 answer

Read file/folder Availability Status

C# - I'm building a console app to read the OneDrive folder status. I can read so many attributes of file/folder but don't know how to get the Status column value here. UPDATED: This approach is different that the one that describe here (using…
ndh103
  • 96
  • 1
  • 6
1
vote
2 answers

Which FileShare option is used with FileInfo.OpenRead method?

On .NET Framework documentation says that when I use FileInfo.OpenRead method a read-only FileStream is created but, which FileShare option is internally used? Once I've opened the file is read or write locked?
1
vote
2 answers

VB.Net - FileInfo.FullName - Am I missing something?

I have some some code which was written before I started here (sounds like a submission for The Daily WTF!) which loads an xml file for processing (the Throw line has been simplified to hide the identity of the culprit, otherwise its verbatim). Try …
Shevek
  • 3,869
  • 5
  • 43
  • 63
1
vote
3 answers

FileInfo instead of file path want to give blobstorage url

I am using EPPlus to create excel sheet from existing template. My code uploaded on azure blob storage. which is used by Azure data factory custom activity. for This activity I need to use template excel file which is in azure blob. I want to give…
sangram parmar
  • 8,462
  • 2
  • 23
  • 47
1
vote
1 answer

Using linq with if-query

i have the following code which groups a list of FileInfos: var group_infos = from info in fileInfos where info.Length < 1024 * 1024 group info by info.Name into g where g.Count() > 1 …
Basssprosse
  • 334
  • 1
  • 3
  • 17
1
vote
1 answer

Why is the FileAttributes value for a file which does not exist -1?

Consider the below code - FileInfo fileInfo = new FileInfo("C:\\doesNotExist.txt"); Console.WriteLine(fileInfo.Attributes); Console.WriteLine(fileInfo.Attributes.HasFlag(FileAttributes.ReadOnly)); As per the documentation, the default underlying…
user2744506
1
vote
1 answer

Remove entries from a data binded combobox based on relative file size, VB.Net

I am currently working in VB.NET visual studio express 2013 with an SQL back end. I have an sql query that pulls a list of jobs from an sql server. From there, this list is populating into a combo box for a production supervisor to push jobs into…
Cheddar
  • 530
  • 4
  • 30