This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Please rate your experience Yes No. Any additional feedback? Namespace: System. IO Assemblies: mscorlib. Returns the creation date and time of the specified file or directory. Note This method may return an inaccurate value, because it uses native functions whose values may not be continuously updated by the operating system. Viewed 17k times. It just does not grab the values at all The textfile name is exactly the same.
OpenText "BikeDefault. ReadLine DefSR. Close End Sub I've compared this code a bunch of times to the example I was given and I see nothing different. Improve this question. Colby Bradbury Colby Bradbury 57 1 1 gold badge 1 1 silver badge 8 8 bronze badges. Are you sure the file exists? I'd make sure that you use the fully qualified path, and not just the relative path.
Also, are you sure the file actually has lines of data in it? Im absolutely certain. Try fully qualifying the filename with the path.
Otherwise it'll read from the "Current Directory", and it's not always obvious what that is. It might even be creating a totally new and empty file. Hmm it seems this was the problem. Turns out I've been lied too or the information is outdated. Add a comment. Active 1 year ago. Viewed 15k times. Add fileNameOnly Next. Improve this question. BanForFun 4 4 silver badges 15 15 bronze badges. Add a comment. Active Oldest Votes. This is how I would grab both the created date, and the last write time.
For each sfile as datetime. Improve this answer. TonyW TonyW 6 6 silver badges 17 17 bronze badges. Charles Paske Charles Paske 76 6 6 bronze badges. Inside the For Each you can just wrap all your logic in an if statement comparing to the FileInfo properties. You could also use linq to limit your selection of returned filed from the GetFiles function on the DirectoryInfo but I'd only recommend that if you're familiar with linq but it would be more efficient.
DirectoryInfo directory. CreationTime 'Add the row to the data table dt. WriteLine ex.
0コメント