Ghost Folder on DLNA players

Questions regarding using our product with a UPnP Digital Media Adaptor may be placed here
Forum rules
Synology Community is the new platform for the enthusiasts' interaction, and it will soon be available to replace the Forum.
darloal
Trainee
Trainee
Posts: 11
Joined: Mon Jan 24, 2011 9:50 pm

Ghost Folder on DLNA players

Unread post by darloal » Wed Oct 26, 2011 10:05 am

Hi,

I have delete a folder on my DS. However in the Diskstation - Video folder on any DLNA player in the house the folder is still there. I've re-searched for media servers so the files on the DLNA players update the content they show, but the file won't disappear.

If I click in the folder in question it opens up the ALL the videos that were there.
When I click on one of the videos from a PS3 I get this message;
"The folder could not accessed. The content may have been deleted from the media server."

I know it has - as I deleted it! How do I get rid of this "ghost" folder so it doesn't show?

Thanks in advance.

td911
Trainee
Trainee
Posts: 16
Joined: Fri Oct 15, 2010 4:35 pm

Re: Ghost Folder on DLNA players

Unread post by td911 » Tue Nov 01, 2011 10:57 pm

Did you set a "symbolic link"?
If you did, you need to delete it. Just deleting the folder doesn't work.

kheops
I'm New!
I'm New!
Posts: 1
Joined: Wed Nov 16, 2011 12:49 pm

Re: Ghost Folder on DLNA players

Unread post by kheops » Wed Nov 16, 2011 2:07 pm

Hi,

I have the same problem (DS211j - TV Samsung), I have deleted and moved folder and files , but the files/folders are still appear on the samsung player.

When I click on one of the videos from my TV I get a message : "unable to read" or something like that :roll:

Do you have an idea ?

Thx

KheOps

mkrus
I'm New!
I'm New!
Posts: 1
Joined: Thu Feb 09, 2012 2:56 pm

Re: Ghost Folder on DLNA players

Unread post by mkrus » Thu Feb 09, 2012 3:00 pm

Hi

I get the same since upgrading to the latest official version of dsm of my Ds211j
Anyone have a fix?

Mike

sawboman
I'm New!
I'm New!
Posts: 6
Joined: Thu Jan 21, 2010 9:59 pm

Re: Ghost Folder on DLNA players

Unread post by sawboman » Tue Feb 14, 2012 2:26 pm

I'm getting the same problem on XBMC, WDTV Live and PS3. Old folders that I know I've deleted as when I go through DSM or Windows explorer on PC (W7)they do not appear. Has anybody had any experience with this and can you suggest any methods to remove these "ghost" folders/files

Thanks,
Dave

rechnerzuhause
I'm New!
I'm New!
Posts: 2
Joined: Wed Feb 15, 2012 10:20 am

Re: Ghost Folder on DLNA players

Unread post by rechnerzuhause » Wed Feb 22, 2012 9:51 pm

Just had the same problem. I fixed it by moving the hole content of VIDEO to a new directory and backwards.
And WOW, the ghostfolders/files are gone :-)

Ciao RZ

forcetalent
I'm New!
I'm New!
Posts: 1
Joined: Sun Jun 22, 2014 11:26 am

Re: Ghost Folder on DLNA players

Unread post by forcetalent » Sun Feb 15, 2015 11:30 am

Good tip by the last poster.
This gave me an idea which significantly reduced the indexing time if you have a large video (or any media) folder.

1- I created a folder with the same exact name including case sens in a local folder on my PC.
2- Placed a small jpeg in their called "folder.jpg" (since folders use this filename for thumbnailing).
3- Copied it to the exact location on the Synology where the deleted Ghost folder shows up. I browse there with Windows Explorer using a UNC path.
4- Close Explorer and Re-Open and browse back to the UNC path.
5- Delete the folder and soon after the Ghost folder should be gone, if you haven't changed the media servers default refresh interval.

njitgrad
Novice
Novice
Posts: 55
Joined: Thu Feb 19, 2015 5:31 pm

Re: Ghost Folder on DLNA players

Unread post by njitgrad » Sun Feb 22, 2015 5:05 am

I've tried both methods suggested above but I still can't get the ghost files to disappear. I went as far as uninstalled Video Package, deleting the video folder, and re-installing (re-creating the video folder in the process) but the ghost files are still there. Frustrating! Need a solution that works for my DS214Play.

njitgrad
Novice
Novice
Posts: 55
Joined: Thu Feb 19, 2015 5:31 pm

Re: Ghost Folder on DLNA players

Unread post by njitgrad » Mon Feb 23, 2015 4:04 pm

I was finally able to get rid of ghost folders (and files) but it's a real pain and a lot of manual labor depending on how many files/folders you relocated/deleted on your NAS.

The method below works for DSM 5.1 on my DS214Play.

The lesson here is to not move things around too much once you get your video files on your NAS.

To eliminate a ghost file open Notepad on your PC and (without even typing anything in the file) just save the file as missingmovie.mp4 onto the mapped video network drive (where "missingmovie.mp4" matches the movie title and extension exactly). After that, delete the file using DSM File Station. On your TV just re-navigate from the top level folder to where the ghost used to be. It may not disappear instantaneously so just re-navigate periodically until it's gone (could take a couple of minutes for some files).

To eliminate a ghost folder create a new folder using DSM File Station (with the same exact name as the ghost) in the exact location where the ghost is. Then just delete the folder using DSM File Station and it should disappear in a few seconds. On your TV just re-navigate from the top level folder to where the ghost used to be. It may not disappear instantaneously so just re-navigate periodically until it's gone (could take a couple of minutes for some folders).

Hope this helps.

French_Bloke
I'm New!
I'm New!
Posts: 7
Joined: Thu Mar 02, 2017 8:05 pm

Re: Ghost Folder on DLNA players

Unread post by French_Bloke » Mon Mar 06, 2017 7:47 am

Thanks njitgrad, that works.

seuil
Beginner
Beginner
Posts: 21
Joined: Mon Mar 20, 2017 11:31 am

Re: Ghost Folder on DLNA players

Unread post by seuil » Mon Mar 27, 2017 9:21 am

Hi,

I you want a efficient and definitive solution here it is.

The fact is synology indexing don't handle folder suppression and is a bit late in handling files moves or suppression.

I make a lot of movement in my music folders and really need indexation to be reactive.

I find in a wiki this method:

I you don't have one, create a new share folder with the name "scripts"
Note on which volume you create this folder (in my case volume3)
In that folder create de textfile named remove_orpheans.sh
Put in that file the following commands

Code: Select all

#!/bin/sh
# Usage: ./remove_orphans.sh [-f]
 
[ "$1" = "-f" ] && REMOVE=1
 
IFS='
'

for db in directory; do
    for testfile in `/usr/bin/psql mediaserver admin -tA -c "select path from $db;"`; do
        if [ ! -d "$testfile" ]; then
            echo "MISSING FOLDER: $testfile"
            [ -n "$REMOVE" ] && synoindex -D "$testfile"
        fi
    done
done

for db in music video photo; do
    for testfile in `/usr/bin/psql mediaserver admin -tA -c "select path from $db;"`; do
        if [ ! -f "$testfile" ]; then
            echo "MISSING FILE: $testfile"
            [ -n "$REMOVE" ] && synoindex -d "$testfile"
        fi
    done
done
This script open index databases and on each item check if it is always on drives, If not it remove from database.

Then in scheduled task, every hour for example launch this script with the following command, adapting the number of the volume you use :

Code: Select all

/bin/sh /volume3/scripts/remove_orphans.sh -f
Then your indexation will be clean, one hour maximum after deleting files/folder or moving it.
If you don't need too much reactivity, schedule it every day, it will be fine.

I found and improved the code from this url : https://wacha.ch/wiki/synology

Best regards
DS1511+ & DX513

takthetank
I'm New!
I'm New!
Posts: 1
Joined: Fri Nov 10, 2017 11:04 am

Re: Ghost Folder on DLNA players

Unread post by takthetank » Wed Jan 03, 2018 1:13 pm

Thank you for the script, I tried to run it but I get the following message:
Task: remove_orphans
Start time: Wed, 03 Jan 2018 14:07:27 GMT
Stop time: Wed, 03 Jan 2018 14:07:28 GMT
Current status: 0
Standard output/error:
psql: FATAL: Peer authentication failed for user "admin"
psql: FATAL: Peer authentication failed for user "admin"
psql: FATAL: Peer authentication failed for user "admin"
psql: FATAL: Peer authentication failed for user "admin"

Can someone help me please?

=========== UPDATE ===========
Never mind, found it. Just use user 'postgres' instead of 'admin' in your script and it works like a charm!
=============================
seuil wrote:Hi,

I you want a efficient and definitive solution here it is.

The fact is synology indexing don't handle folder suppression and is a bit late in handling files moves or suppression.

I make a lot of movement in my music folders and really need indexation to be reactive.

I find in a wiki this method:

I you don't have one, create a new share folder with the name "scripts"
Note on which volume you create this folder (in my case volume3)
In that folder create de textfile named remove_orpheans.sh
Put in that file the following commands

Code: Select all

#!/bin/sh
# Usage: ./remove_orphans.sh [-f]
 
[ "$1" = "-f" ] && REMOVE=1
 
IFS='
'

for db in directory; do
    for testfile in `/usr/bin/psql mediaserver admin -tA -c "select path from $db;"`; do
        if [ ! -d "$testfile" ]; then
            echo "MISSING FOLDER: $testfile"
            [ -n "$REMOVE" ] && synoindex -D "$testfile"
        fi
    done
done

for db in music video photo; do
    for testfile in `/usr/bin/psql mediaserver admin -tA -c "select path from $db;"`; do
        if [ ! -f "$testfile" ]; then
            echo "MISSING FILE: $testfile"
            [ -n "$REMOVE" ] && synoindex -d "$testfile"
        fi
    done
done
This script open index databases and on each item check if it is always on drives, If not it remove from database.

Then in scheduled task, every hour for example launch this script with the following command, adapting the number of the volume you use :

Code: Select all

/bin/sh /volume3/scripts/remove_orphans.sh -f
Then your indexation will be clean, one hour maximum after deleting files/folder or moving it.
If you don't need too much reactivity, schedule it every day, it will be fine.

I found and improved the code from this url : https://wacha.ch/wiki/synology

Best regards

WhyDoesntItWork
I'm New!
I'm New!
Posts: 3
Joined: Mon Sep 10, 2018 6:20 pm

Re: Ghost Folder on DLNA players

Unread post by WhyDoesntItWork » Mon Sep 10, 2018 6:30 pm

This looks exactly what I want but I can't get it to work.

/volume1/photo/scripts/remove_orphans.sh: line 3: $'\r': command not found
/volume1/photo/scripts/remove_orphans.sh: line 5: $'\r': command not found
/volume1/photo/scripts/remove_orphans.sh: line 8: $'\r': command not found
/volume1/photo/scripts/remove_orphans.sh: line 9: syntax error near unexpected token `$'do\r''
'volume1/photo/scripts/remove_orphans.sh: line 9: `for db in directory; do


I am wondering if this is a carriage return encoding issue, I cut and pasted in Windows, saved to a folder on the NAS and then ran it from an SSH session. I have tried using sublime and encoding it UTF but I get the same error.

I am not a Linux person so am a bit stuck. Anybody got any ideas?

WhyDoesntItWork
I'm New!
I'm New!
Posts: 3
Joined: Mon Sep 10, 2018 6:20 pm

Re: Ghost Folder on DLNA players

Unread post by WhyDoesntItWork » Mon Sep 10, 2018 6:53 pm

Looks like bash doesn't like Windows generated files

https://askubuntu.com/questions/966488/ ... pts-in-wsl

I'll spin up my Xubuntu VM in the morning and generate it in there. Trying to mount the synology in that is like crawling over broken glass however :oops:

WhyDoesntItWork
I'm New!
I'm New!
Posts: 3
Joined: Mon Sep 10, 2018 6:20 pm

Re: Ghost Folder on DLNA players

Unread post by WhyDoesntItWork » Tue Sep 11, 2018 11:14 am

That's looking really good thanks, duplicate thumbnails removed :D

You need to use postgres as a user as takethetank said above.

I created the file in a Xubuntu VM. When I needed to amend when it was appearing not to work, I used sublime in Windows. You can save as a Bash script which then does \n rather than \r\n for the line endings.


I got this error which stumped me for a few minutes, I thought it couldn't find the script

/bin/sh /volume1/photo/scripts/remove_orphans.sh -f
/volume1/photo/scripts/remove_orphans.sh: line 1: #!/bin/sh: No such file or directory

just having a look on stack overflow, the # lines at the top may not be correctly commented which is causing this, sorry, I am a database specialist, not Linux!
sprinkling a few echo statements in the script showed it was working. :mrgreen: :mrgreen: :mrgreen:

Post Reply

Return to “Streaming Multimedia Server”