Locating files in the media section Options
mortenbock
Posted: Tuesday, August 26, 2008 10:18:36 AM

Rank: Addict

Joined: 7/19/2006
Posts: 789
Location: Århus, Denmark
Hi everyone.

A client just asked med to figure out where certain files are located on their solution. They have a HUGE media library, and alle I've got to go after is the url to the file:

/media/53278/the-file-name.pdf

Is there any clever way to locate to parent folder path of this file? Maybe by going straight to the database?

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

rsoeteman
Posted: Tuesday, August 26, 2008 10:50:32 AM

Rank: Devotee

Joined: 4/3/2008
Posts: 68
Location: The Netherlands
Hi Morten,

With the query below I can find my Company Logo in the Database (not a huge structure) but it's similar to your request I think.

Code:
Select UmbracoNode.ParentId as ParentNode, UmbracoNode.Id as Node  from  UmbracoNode
INNER JOIN cmsPropertyData on UmbracoNode.Id = cmsPropertyData.ContentNodeId
where dataNvarchar = '/media/190/soetemansoftwarelogo.jpg'


Hope this helps.

Richard

ASP.NET and Umbraco development - Soeteman Software
neehouse
Posted: Tuesday, August 26, 2008 10:58:40 AM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,074
Location: Charleston, West Virginia, United States
Morten,

The number in the path relates to a property in the database. cmsPropertyData table id field to be exact. This record should have a reference to a contentNodeId. From there, you can get the path from the node using either GetMedia, or a direct call to umbracoNode table with the path and parent fields.

Hope this helps


• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
neehouse
Posted: Tuesday, August 26, 2008 11:00:01 AM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,074
Location: Charleston, West Virginia, United States
Or do what richard says.. Same idea, slight differencein approach.

• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
mortenbock
Posted: Tuesday, August 26, 2008 11:11:16 AM

Rank: Addict

Joined: 7/19/2006
Posts: 789
Location: Århus, Denmark
Ok, I have tried the approaches, and no records are returned. I'm guessing this means that they have deleted the folder containing the files that they are looking for.

Is that a valid conclusion?

I also tried this:

select * from cmscontentxml
where [xml] like '%nodeTypeAlias="File%' and [xml] like '%/media/53278/lf-elf_no_200.pdf%'

which didn't return anything either.

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

neehouse
Posted: Tuesday, August 26, 2008 11:29:24 AM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,074
Location: Charleston, West Virginia, United States
Yes, they could have deleted the umbraco node with the data, and the file still exist (personal annoyance of mine too).

The latter select nodeTypeAlias should be umbracoFile if I am correct.

If they deleted the node tree, hopefully you have a backup of the database that has those entries, and can extract them out, and restore them to the other database.

• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
rsoeteman
Posted: Tuesday, August 26, 2008 11:29:36 AM

Rank: Devotee

Joined: 4/3/2008
Posts: 68
Location: The Netherlands
Quote:
Is that a valid conclusion?


Must be otherwise it was in the result

ASP.NET and Umbraco development - Soeteman Software
mortenbock
Posted: Tuesday, August 26, 2008 2:15:01 PM

Rank: Addict

Joined: 7/19/2006
Posts: 789
Location: Århus, Denmark
neehouse wrote:
If they deleted the node tree, hopefully you have a backup of the database that has those entries, and can extract them out, and restore them to the other database.


They are self hosted, so I don't know if they have backups. They'll just have to do some manual reentering of the data.

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.