Invalid file properties returned by dir
Show older comments
So, I've been using dir to quickly get me a catalogue of all the file sizes of a specific type of file. My code works, however, there is one particular file, which returns into the output:
name: 'dagkgjkajk.his'
date: ''
bytes: []
isdir: 0
datenum: []
Does anyone know why this may be the case?
14 Comments
Azzi Abdelmalek
on 23 Aug 2013
post your code
Iain
on 23 Aug 2013
Walter Roberson
on 23 Aug 2013
Are you able to see the file in the Microsoft File Explorer?
Walter Roberson
on 23 Aug 2013
Iain, is the file system mounted over a network, or is it a local disk?
Walter Roberson
on 23 Aug 2013
Which version of MATLAB is being used?
dpb
on 23 Aug 2013
I'd wonder what the OS dir command returns directly at command line just to ensure it's not an anomaly in the Matlab dir function.
Presuming they're consistent it reverts to how the file was created -- in a Matlab process gone bad or somehow else as to try to pin blame on Matlab or somewhere/somebody else.
Walter Roberson
on 24 Aug 2013
WIth some earlier MS Windows versions you might perhaps run out of directory handles.
And
dos('dir dagkgjkajk.his')
returns an information which makes sense (size,date,name)?
dos('dir ...returns the filename, file date and the file size...
Yet
d=dir('dagkgjkajk.his');
d.size
returns empty field(s) even called explicitly over the same access path?
That seems somewhat bizarre but then makes me wonder if there's an embedded null or somesuch other funky thing inside one field of the directory information.
Can you try coding a direct call of the WinAPI and then look at the return structure contents in depth?
Given the description of the process by which the present file came into existence it would seem the two likely candidates for the screwup would be the instrument itself or the transfer to the networked device had a hiccup altho certainly couldn't rule out other points along the way entirely...
Iain
on 27 Aug 2013
dpb
on 27 Aug 2013
And this does not happen for any other file in the same directory w/ the same access paths, correct?
What if you use the fully-qualified name for this file specifically under the same permutations?
If so, it seems to me it makes the idea of there being hidden character or somesuch anomaly specifically in the information on that one file.
I don't suppose you have a different version of Matlab installed as well to make it convenient to try a second version there to see if can isolate one of Jan's "magic strings" kind of bug in dir()...
Oh, just a thought--what does the string 'J:\....\*.his' expand to for the bogus file info? Does that end up w/ a control character that could somehow be being interpreted incorrectly? I forget for certain, will Win let you try '/' instead of '\' for separators?
Iain
on 27 Aug 2013
dpb
on 27 Aug 2013
Ok, now, I'm REALLY confused. It has stopped doing it.
Ain't science wonderful!!??? :)
Doncha' just love it when these unexplainable anomalies occur? I'd guess that's as good an explanation as will ever come up with although there was a full moon the other night; that could well have had something to do with it as well...
Keep us posted if it comes/goes again and if there is any resolution other than the aforementioned "Stuff happens..."
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!