Obtaining extended file properties (attributes) using VBA

Status
Not open for further replies.

isladogs

MVP / VIP
Local time
Today, 13:39
Joined
Jan 14, 2017
Messages
18,577
Recently, this thread 'Windows 10 Retrieving Extended File Properties' raised issues about using the GetDetailsOf method to retrieve extended file properties (attributes).

GetDetailsOf is a member of the VBA library 'Microsoft Shell Controls and Automation' based on Shell32.dll.

For anyone else who hasn't heard of this, each file includes several extended properties which can be retrieved as needed using this method.

For example:
• Date created / date modified / date last accessed
• File size / file type / author / location

Certain types of file will also contain additional extended properties including:
• Height / width / horizontal resolution / vertical resolution / bit size (image files)
• Contributing artist / album / year / genre / tile / track # / length / bit rate (audio files)

In all, there are a total of 311 extended properties though no files will ever use all of these

I decided to investigate this method further and have created a database which provides an easy way of obtaining and storing all the extended properties for an individual file or all files of a specified type in a selected folder.

The attached text files contain the full list of extended properties (attributes) & example output for an audio file

The zip file contains the database FileAttributes.accdb, a PDF file with full details and screenshots as well as several other text files with examples of the extended properties (attributes) obtained for different types of file

The database includes the VBA reference library 'Microsoft Shell Controls and Automation'

NOTE: it also includes an example of a dynamic crosstab query where the column headers are automatically updated to match the underlying data

attachment.php


Any questions or suggestions, please send me a private message or email me using the address given in the PDF file
 

Attachments

Last edited:
Thanks Colin. Filed away for use later! :)
 
Last edited:
Colin,

Do you have a list of attributes for jpg?
Is there a link to some detailed info on attributes for jpg (I haven't found one)?
 
I have now!
Just ran the FileAttributes.accdb on a random JPG file - see attached PDF
It only takes a few seconds to do.

Had to zip it as the file was unexpectedly large - its only a 1 page report

I've no idea where you can get details of JPG file type
 

Attachments

Hi Colin,

Tremendous nice job this!
However, your code does not treat symlink files. (attr 198 gives link target)

What I want to do is this:
- I recently deduplicated a lot of files gaining almost 400 GB of data.
- The originals were replaced by symlinks
- I store all of my email-attachments also in a directory which is back-upped to the cloed.

Previuosly this was dropbox, switched to Google Drive. You hear me coming.
I changed the directory name, and now I want to change all the target links (property 198 of the file) also.

I already coded up to collecting all filenames, but I don't find a way to change the properties

Just to inform you, to adapt your code including symlinks. (which is impossible if you use the explorer API)

If you know how to change a certain property, I'd be hapy to hear it.

Johan
 
Posts #5 & #6 just discovered hiding in a dusty cupboard and belatedly approved. Apologies for the delay.
Recommend reporting your own posts in moderated areas in future as this will alert mods and significantly speed things up

@jeedee
I'm sorry but I don't know what you mean by symlink so don't know how to advise. I also don't use Google Drive....

This thread is purely intended for reading extended file properties - not for changing them. However, you may find this link by Allen Browne useful:
http://allenbrowne.com/func-DAO.html

also see this thread: https://www.access-programmers.co.uk/forums/showthread.php?t=283288

Philip.Hanebeck
Already answered via email exchange some months ago
 
Attached is the latest update to the utility - version 2.1
Changes include:
a) updated conditional compilation for all APIs and other changes related to use in 64-bit Access
b) bug fixes mainly related to files with apostrophes in filename/path

As this thread is closed, please let me know via PM if there are any issues.
 

Attachments

Last edited:
Attached is an updated version of the app with some minor code changes needed for extended file properties for video files.
I've also added a link to a You Tube video explaining how the app is used.
I created this in connection with a recent Access User Group session on Thur 2 Sept


As this thread is closed, please let me know via PM if there are any issues or if you have any questions..
 

Attachments

Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom