Obtaining extended file properties (attributes) using VBA (1 Viewer)

Status
Not open for further replies.

isladogs

MVP / VIP
Local time
Today, 14:46
Joined
Jan 14, 2017
Messages
18,186
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



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

Attachments

  • FileAttributes.zip
    1.3 MB · Views: 2,640
  • FileAttributesList.txt
    5.9 KB · Views: 2,095
  • MusicFileAttributes.txt
    1.5 KB · Views: 1,413
  • AttributesByFileType.PNG
    AttributesByFileType.PNG
    65.5 KB · Views: 11,797
Last edited:

RuralGuy

AWF VIP
Local time
Today, 08:46
Joined
Jul 2, 2005
Messages
13,826
Thanks Colin. Filed away for use later! :)
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 10:46
Joined
Jan 23, 2006
Messages
15,364
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)?
 

isladogs

MVP / VIP
Local time
Today, 14:46
Joined
Jan 14, 2017
Messages
18,186
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

  • JPGFileAttributes.zip
    545.2 KB · Views: 1,137

JEEDEE

New member
Local time
Today, 15:46
Joined
May 29, 2016
Messages
5
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
 

isladogs

MVP / VIP
Local time
Today, 14:46
Joined
Jan 14, 2017
Messages
18,186
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
 

isladogs

MVP / VIP
Local time
Today, 14:46
Joined
Jan 14, 2017
Messages
18,186
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

  • ExtendedFileProperties_v2.1.zip
    1.5 MB · Views: 761
Last edited:

isladogs

MVP / VIP
Local time
Today, 14:46
Joined
Jan 14, 2017
Messages
18,186
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

  • ExtendedFileProperties v2.2.zip
    1.1 MB · Views: 658
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom