Questions tagged [system.io.fileinfo]

77 questions
1
vote
1 answer

System.IO.FileInfo cannot determine that a file exists on a server at the other end of a network

This is my Visual Basic 2005 .NET code: Dim imgflnm as string = "c:\testfolder\testdoc.txt" Dim fltotest As New System.IO.FileInfo(imgflnm) Dim tsrslt As Boolean tsrslt = fltotest.Exists System.Web.HttpContext.Current.Response.Write("source file…
1
vote
1 answer

FileInfo to HttpPostedFileBase in mvc controller?

I have a web application that has a functionality that consists in put a list of images in a folder (on the same server that the web application) and then process that images to upload them to the web application format. For that action i have a…
Phoenix_uy
  • 3,173
  • 9
  • 53
  • 100
1
vote
2 answers

Dispose FileInfo()

Dim FolderName As New IO.DirectoryInfo(FileLocationFolder) Dim diar1 As IO.FileInfo() = FolderName.GetFiles("*.xml") I am looping through diar1 like the following For Each CurrFile In diar1 Next Does that lock all the files in that…
HelpASisterOut
  • 3,085
  • 16
  • 45
  • 89
1
vote
0 answers

How to find logical length of the file in bytes in C#

I am trying to re-write a part of my application from ATL/COM(C++) to WPF, C#. In the older application they use m_inputFile = new CFile(fileName,CFile::modeRead); DWORD fileLength= (DWORD) m_inputFile->GetLength(); But when I use FileInfo.Length…
user2495173
  • 311
  • 2
  • 5
  • 17
1
vote
1 answer

Sorting the result of Directory.GetFiles in vb.net

I have one directory contain all the tif formate file ,near about 30 file with the name like that B_1 ,B_2...upto B_15 and F_1 ,F_2...upto F_1. when i am getting file from getfile method. Dim di As New IO.DirectoryInfo("c:\ABC\") Dim diar1…
Dolphin
  • 138
  • 1
  • 3
  • 16
1
vote
2 answers

Recursive files/folder list loop out

How do I into recursive loops? First off, I want to loop out lists of folders and files, of course these files should be inside their respective folders and I'm gonna display the list on the web through HTML and CSS. I have a List and…
HenrikP
  • 844
  • 5
  • 16
  • 37
1
vote
1 answer

Delete a text file from a path using "System.IO" in visual basic 2010

I have this code: Dim WriterDay1 As New System.IO.StreamWriter("C:\Users\IOSEagle\Desktop\My Projects\Microsoft Visual Basic 2010\Form\Programes\MyAlarm\MyAlarm\RepeatDays\Monday.txt") WriterDay1.Write(MondayCheckBox.Text) WriterDay1.Close() How…
Mousa Alfhaily
  • 1,260
  • 3
  • 20
  • 38
1
vote
3 answers

System.IO.File.Copy throws System.UnauthorizedAccessException

I get an error when I try to copy a file from one location to another ONLY WHEN the file is already present in the destination. This happens inspite of setting the overwrite flag to true. I am not getting any clue. This is the code. …
S_R
  • 493
  • 1
  • 9
  • 22
1
vote
3 answers

C# Get File properties without using System.IO.FileInfo

is it possible to extract 'some' properties from a given file without using System.IO.FileInfo at all? I mean, I love using FileInfo in cases where I just have a few files to deal with, but if, for example, I want to grab a list of file names from,…
sergeidave
  • 662
  • 4
  • 11
  • 23
1
vote
2 answers

Browse for file window without uploading the file

Is there a way to get the select file dialog box open and putting the location of the file into a textbox without ever uploading the file? ETA I'm using VB.NET in a web page. By using the asp:fileupload tag I can get the file…
Alverant
  • 229
  • 2
  • 5
  • 13
1
vote
1 answer

FileInfo object property question - C#?

Does the following System.IO.FileInfo properties map to the following properties in the Windows Explorer application: CreationTime = Date Created LastWriteTime = Date Modified LastAccessTime = Date Accessed
Michael Kniskern
  • 24,792
  • 68
  • 164
  • 231
0
votes
3 answers

DirectoryInfo.GetFiles method not returning any files

I'm trying to return the .config files that exist in %WINDIR%\System32\inetsrv\config. For this I am using the following code: DirectoryInfo configFolder = new DirectoryInfo(Environment.ExpandEnvironmentVariables("%WINDIR%") +…
neildeadman
  • 3,974
  • 13
  • 42
  • 55
0
votes
6 answers

Using FileInfo to see when a file was updated... on another server

Hey guys I am pulling in a Vehicle Feed to an autodealer website for one of our clients. Every night at midnight(ish) the new XML file is uploaded to our FTP and it overwrites the current one. Currently he has two Identical websites and the file…
Gordnfreeman
  • 1,615
  • 1
  • 15
  • 24
0
votes
1 answer

FileInfo.CopyTo() throws exception when trying to overwrite file

I have the following piece of code in a .NET 6 app that copies some files to a different destination on the file system: DirectoryInfo targetDir = GetTargetDir(); foreach (FileInfo fi in GetFilesToCopy()) { …
0
votes
2 answers

How to delete file after downloading in dotNET Core MVC 6 with C#?

I want to delete file just after this is downloaded. I am using .Net Core MVC 6 C# Controlller. public IActionResult DownloadPDFReport(string fileName) { string appBaseUrl = _webHostEnvironment.WebRootPath; //…
GOPAL SHARMA
  • 657
  • 2
  • 12
  • 37