# How to get meta data from file?

**URL:** <https://resource.dopus.com/t/how-to-get-meta-data-from-file/14175>\
**Category:** Help & Support\
**Created:** [October 22, 2012, 1:59am UTC](https://resource.dopus.com/t/how-to-get-meta-data-from-file/14175 "2012-10-22T01:59:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbone](https://resource.dopus.com/user_avatar/resource.dopus.com/tbone/32/25726_2.png) [@tbone](https://resource.dopus.com/u/tbone)\
**Post date:** [October 22, 2012, 1:59am UTC](https://resource.dopus.com/t/how-to-get-meta-data-from-file/14175/1 "2012-10-22T01:59:07Z")

</div>

Hi there,

i tried to set a files created/modified date from the meta data of the file. To be more precise, i wanted to get the "year" field of an mp3-file to be the filesystems date of that file (01.01.[YEAR] or something). Can that be done ?

I searched the manual and would know how to set those fields with "SetAttr META .." and so on, but how do you "get" them !?.. o)  
I thought of some {}-curly bracket magic at first, but the manual did not help on those.

Thank you!.. o)  
Rob.

ps: What i was about to do was: Finding mp3-music by year with the integrated dopus-search. But if i select "music" i cannot choose the "year" field, all i have is "release date", and that is nowhere set in any of my files. So i came up with the idea to retreive the "year" of every mp3 and store it into the filesystem - to eventually be able to search by "year".. o)

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [October 22, 2012, 12:44pm UTC](https://resource.dopus.com/t/how-to-get-meta-data-from-file/14175/2 "2012-10-22T12:44:57Z")

</div>

You might be able to do that by adapting the 2nd example here: [Copy Created/Modified times to/from EXIF times](https://resource.dopus.com/t/copy-created-modified-times-to-from-exif-times/6417/1)

I'm not sure why "Year" is missing from the Find/Music options, though. Maybe it was just overlooked until now. We should be able to add that in a future version, unless there's some problem I haven't thought of yet.

---

<div class="post-metadata">

**Author:** ![tbone](https://resource.dopus.com/user_avatar/resource.dopus.com/tbone/32/25726_2.png) [@tbone](https://resource.dopus.com/u/tbone)\
**Post date:** [October 22, 2012, 5:04pm UTC](https://resource.dopus.com/t/how-to-get-meta-data-from-file/14175/3 "2012-10-22T17:04:46Z")

</div>

Hi Leo, yep!..

Thanks for reminding me.. o) I actually downloaded and used your exif-timestamp script, neat!

I was able to modify it, and now my files get their mp3 year! Great!.. o)  
The performance sucks big time, but i don't care.. o)

Thank you again for helping!  
Rob.

This is the function in detail, if anyone else might be interested:

```auto
Rename FILEINFO TO="{mp3year}" RECURSE
@script vbscript
option explicit
dim DOpusRTPath : DOpusRTPath = "d:\bin\file\dopus\dopusrt.exe"
dim Shell : set Shell = CreateObject("WScript.Shell")
Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)
	dim strYear, strDateTime, strCommand
	strYear = strNewName
	strNewName = strOldName
	if (len(strYear) <> 4) then
		DOpus.OutputString "Bad year ["&strYear&"] in file: " & strFilePath & "\" & strFileName
		exit function 'not a valid year
	end if
	if (cint(strYear) < 1930) or (cint(strYear) > year(date())) then
		DOpus.OutputString "Bad year ["&strYear&"] in file: " & strFilePath & "\" & strFileName
		exit function 'not a valid year
	end if
	strDateTime = strYear & "-01-01 00:00:00"
	strCommand = """" & DOpusRTPath & """ /cmd SetAttr FILE=""" & strFilePath & "\" & strFileName & """ MODIFIED=""" & strDateTime & """ CREATED=""" & strDateTime & """"
	Shell.Run strCommand,0,true
End Function

```
