Leaving files in 'Watch Folder'

When things doesn't work as they should.
Post Reply
Krzysztof
Posts: 10
Joined: Wed Aug 22, 2018 11:28 am

Leaving files in 'Watch Folder'

Post by Krzysztof » Thu Nov 08, 2018 11:16 am

Roberto,

Mayan does not remove files from 'Watch Folder' and adds the same files over and over again.

Is it possible to get around it or is it the 'Watch Folder' principle?

Regards,
Krzysztof

KevinPawsey
Posts: 81
Joined: Wed Aug 22, 2018 2:52 pm

Re: Leaving files in 'Watch Folder'

Post by KevinPawsey » Fri Nov 09, 2018 12:32 pm

I had this issue before, and I managed to pin the issue down to the following:

I was using a Mac to connect to an SMB share... it turns out that there is something in the way that the Mac writes to SMB shares. I used to get 2-3 copies of the same file because the file wasn't unlocked to be able to be deleted, so it remained in the folder to be re-scanned.

Not sure if this is your setup, but what improved the situation for me was to stop sharing the watched folder as SMB, and share it as AppleTalk, and that enabled the file lock to unlock properly and be deleted after the folder scan.

Hope that helps.

Kevin
Running Mayan-EDMS on: OpenMediaVault, (Docker plugin), on x86 dual-core

teqqyde
Posts: 1
Joined: Mon Jan 28, 2019 10:16 am

Re: Leaving files in 'Watch Folder'

Post by teqqyde » Mon Jan 28, 2019 12:26 pm

Hi,
I've got the same issue. I created a folder, installed apache2 and configured webdav. Now I'm using my Phone with the ScannerPro App and save the pdf to my webdav folder.
The pdf is recognised by the system, but leave for always there. The first time i recognised it, i got over 1200 documents from one pdf in Mayan.

So, is there any automatic workaround in Mayan to not run in the same issue another time? I cannot create a script to remove all files from this folder, because i can be deleted and not be indexed by mayan if the trigger "goes wrong".

Thx.

User avatar
rosarior
Posts: 211
Joined: Tue Aug 21, 2018 3:28 am

Re: Leaving files in 'Watch Folder'

Post by rosarior » Tue Jan 29, 2019 8:01 am

When this happens it is usually caused by a missing filesystem permission. Check to see if the Mayan system user account has the filesystem permission to delete files from the watch folder.

KevinPawsey
Posts: 81
Joined: Wed Aug 22, 2018 2:52 pm

Re: Leaving files in 'Watch Folder'

Post by KevinPawsey » Mon Feb 25, 2019 11:43 am

Just to add to this, and in case it is of use to anyone else...

I run Mac OSX and I scan things straight to a watch folder... when a drive is mapped in MacOS it writes a ._[filename] file to the folder, which caused me issues when I was using the staging folder. I was seeing these ._ files as being available for import.

I discovered that this is something that was quite common in OSX, and there is a way of switching this off for network folders.

Run Terminal:
- Command Spacebar, type "terminal" (without quotes) and press enter
At the prompt (assuming you have permissions to run terminal on your machine) type in the following command:

Code: Select all

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
and then press enter... it will look like nothing has been done. Then type the following:

Code: Select all

killall Finder
... this will restart Finder (MacOS equivalent of windows explorer).
Voila! ... no more ._ files on network drives.

For the above, where is says "type in" you can also copy/paste of course.

This should help on Watch Folders, whereby these ._ files are created automatically if you have the drive mapped, but can't be imported... keeps things tidy. These files wont show up in Finder on the MacOS, as they are a part of how the OS works... but you can see them by going to a CLI on Linux, changing to the Watch Folder, and then doing a:

Code: Select all

ls -al
This will show all files, and if you want to remove them, then the following command should remove them:

Code: Select all

rm ._*
not tested the above command... use with caution

Anyway, hope that helps someone
Running Mayan-EDMS on: OpenMediaVault, (Docker plugin), on x86 dual-core

qweqweqwe
Posts: 3
Joined: Wed Feb 27, 2019 11:16 pm

Re: Leaving files in 'Watch Folder'

Post by qweqweqwe » Wed Feb 27, 2019 11:17 pm

Check permissions. My folder allowed read and execute for mayan user but not delete. Use chmod.

KevinPawsey
Posts: 81
Joined: Wed Aug 22, 2018 2:52 pm

Re: Leaving files in 'Watch Folder'

Post by KevinPawsey » Wed Mar 06, 2019 1:12 pm

qweqweqwe wrote:
Wed Feb 27, 2019 11:17 pm
Check permissions. My folder allowed read and execute for mayan user but not delete. Use chmod.
If you are going to use chmod, I believe that the chmod command should be

Code: Select all

chmod 755 -R {folder_name}
Hope that helps.
Running Mayan-EDMS on: OpenMediaVault, (Docker plugin), on x86 dual-core

Post Reply