# Newbie Question : Understanding variable files in scanner

**URL:** <https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625>\
**Category:** Dev/API Corner\
**Tags:** scanner-agent-dev\
**Created:** [August 21, 2011, 11:58am UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625 "2011-08-21T11:58:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thw\_100](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@thw\_100](https://forums.plex.tv/u/thw_100)\
**Post date:** [August 21, 2011, 11:58am UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625/1 "2011-08-21T11:58:58Z")

</div>

Hi there  
  
to make things simple i start with a small scanner and try to print the files within the terminal :  
  
Scanner is in series directory  
  
#

# Copyright © 2010 Plex Development Team. All rights reserved.

#  
  
import re, os, os.path  
  
import Media, VideoFiles, Stack, Utils

# Look for episodes.

def Scan(path, files, mediaList, subdirs):

# Scan for video files.

VideoFiles.Scan(path, files, mediaList, subdirs)  
  
print “Path: X”, path, “Files : X”, files , “X Media : X”, mediaList ,“X Subdirs : X”, subdirs   
  
print “gammel”   
  
myfiles = 1  
  
print myfiles  
  
  
  
the variable files contains files" if the directory was never scanned, but once the scann got through the files are empty  
  
is there a way todisable this smart scan habbit ( i guess the scanner should only have to deal with changes, but why are you touching the directotries anymway if you are not listing the files ? )  
  
or is there something that i am doing wrong here ? ( my current workaround creating a subdir or remove it, afterwards my file variable is filled with the current files )  
  
Any help are pretty much welcome  
  
Best Regards  
  
TW

---

<div class="post-metadata">

**Author:** ![embeddedcoder](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/embeddedcoder/32/156_2.png) [@embeddedcoder](https://forums.plex.tv/u/embeddedcoder)\
**Post date:** [August 21, 2011, 9:30pm UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625/2 "2011-08-21T21:30:18Z")

</div>

Couple of possible work arounds for you.

1. Always do a force refresh. ~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner -sx -c SECTION\_NUMBER  
  
  
2. Write your own VideoFiles.Scan equivalent using os.listdir or os.walk  
  
  
  
I’d go with the first one since you probably don’t want it for anything except debugging.

---

<div class="post-metadata">

**Author:** ![thw\_100](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@thw\_100](https://forums.plex.tv/u/thw_100)\
**Post date:** [August 23, 2011, 6:41am UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625/3 "2011-08-23T06:41:23Z")

</div>

Thanks,  
  
will try the first one, because as you guessed i was looking for a debug switch.  
  
is there somewhere a documentation for theses settings and/or functions that comes with pms ?  
  
Best Regards  
  
TW

---

<div class="post-metadata">

**Author:** ![embeddedcoder](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/embeddedcoder/32/156_2.png) [@embeddedcoder](https://forums.plex.tv/u/embeddedcoder)\
**Post date:** [August 25, 2011, 3:29am UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625/4 "2011-08-25T03:29:15Z")

</div>

Run the same command but with a -h  
  
That’ll give you a full list of options.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 9:15pm UTC](https://forums.plex.tv/t/newbie-question-understanding-variable-files-in-scanner/10625/5 "2019-12-20T21:15:30Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
