mdls command gives “null” in output
All,
I have shell script that loops recursively through a given folder and generates a metadata report for media files using the mdls command.. The code works most of the time, but sometimes I get null as the output for some media files. Here is my script which finds all m4v files in a given folder and outputs the metadata information for each file found.
cd "path_to_folder"
while IFS= read -r -d $'\0' file; do
mdls "$
file"
echo -e "===================================\n"
done < <(find . \( -iname \*.m4v \) -print0 )
The output sometimes doesnt include complete info for the files. I dont see kMDItemPixelHeight, kMDItemPixelWidth, kMDItemKind etc in the output. Here is a sample output that's missing most of the info.
kMDItemFSContentChangeDate = 2012-04-03 05:45:24 +0000
kMDItemFSCreationDate = 2012-04-03 05:45:24 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = 0
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = 0
kMDItemFSLabel = 0
kMDItemFSName = "video1.m4v"
kMDItemFSNodeCount = 2328812
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = (null)
kMDItemFSTypeCode = ""
=============================================================================
If I run mdls command from the terminal for the video1.m4v, it displays complete info for the file. What am I doing wrong? Is it some spotlight related issue?
Mac Pro, Mac OS X (10.7.3)