• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

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

Status
Not open for further replies.

isladogs

CID VIP
Local time
Today, 21:29
Joined
Jan 14, 2017
Messages
13,931
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: 1,599
  • FileAttributesList.txt
    5.9 KB · Views: 1,174
  • MusicFileAttributes.txt
    1.5 KB · Views: 636
  • AttributesByFileType.PNG
    AttributesByFileType.PNG
    65.5 KB · Views: 8,144
Last edited:

RuralGuy

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

jdraw

Super Moderator
Staff member
Local time
Today, 16:29
Joined
Jan 23, 2006
Messages
13,360
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

CID VIP
Local time
Today, 21:29
Joined
Jan 14, 2017
Messages
13,931
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: 457

JEEDEE

New member
Local time
Today, 22:29
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

CID VIP
Local time
Today, 21:29
Joined
Jan 14, 2017
Messages
13,931
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

CID VIP
Local time
Today, 21:29
Joined
Jan 14, 2017
Messages
13,931
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: 159
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom