File Listing to display Creation/Last Modified Date

ddubnansky

Board Regular
Joined
May 15, 2003
Messages
75
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
  8. 2003 or older
Platform
  1. Windows
I'm trying to create a file listing macro to display the following information contain under a specified directory (which also would include any sub-directories):

Col A: Complete Directory Path
Col B: Filename
Col C: File Extension
Col D: File Size
Col E: Creation Date/Time Stamp
Col F: Last Modified Date/Time Stamp

I'm trying to create a file listing to help rename photos files. (I already have the renaming macro created, so that piece is unnecessary - unless you wish to provide it for other viewers.) I want to rename these files so that they have the Creation Date/Time Stamp in the filename (ex: "DSC012937-20110707-112745.jpg" ---> "Original Filename-Date-Time.OriginalExtension"). This will also allow me to identify where I may have duplicate pictures since the Date/Time stamp will be equal.

Also, any additional available photo ot mp3 related fields (i.e. Artist, Album, Track, etc.) you can provide will allow me to create a multi-use macro for renaming files.

Any assiatance is greatly appreciated. Thanks to all that took the time to view this posting.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I'm getting a compile error (user defined type not found) when it hits the following code:

"Dim FSO As Scripting.FileSystemObject" (in the in the "Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders As Boolean)")
Is there a Reference/Library that I need to enable for this to execute properly?

(Also, I'm using Excel 2010)

Thanks.
 
Last edited:
Upvote 0
Thank you very much for this.

One more question - Do you know where I can find a listing of all available FileItem fields? I'd like to customize your code to include a few more file attributes.

Thanks again.
 
Upvote 0
I'm not thoroughly knowledgeable on the FileScriptingObject, but based on this page:

http://msdn.microsoft.com/en-us/library/1ft05taf(v=vs.85).aspx

It appears there are 12 properties in all:
Attributes, DateCreated, DateLastAccessed, DateLastModified, Drive, Name, ParentFolder, Path, ShortName, ShortPath, Size and Type.

The code presented on the previous website (post 2) looks to be using 10 of them (skipping ParentFolder and Drive).
 
Upvote 0
Again, thanks for everything. This is why I love this site.
 
Upvote 0
In addition to the above code, I'm also looking for how I can populate the "DateTaken" info from the file which Windows Explorer (Win7) now allows displayed. Does anyone know how to include that information?

I've tried "FileItem.Date" and "FileItem.DateTaken" but no luck. Any assistance on this is greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,562
Messages
6,179,526
Members
452,923
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top