-2

I am trying to search (using Python/R/Unix/Bash whatever) for a list of banned words in file and folder names on my network drives. I can use TreeSize but hoping there's a way to script it so it can be automated.

Poola Tony
  • 23
  • 2

1 Answers1

0

As you allready mentioned it in your flags, you can just use os.walk():

import os

input_path = "c:\\"

list_of_bad_words = [bad, word, example]

for (path, dirs, files) in os.walk(input_path):

    for bad_word in list_of_bad_words:

        if bad_word in path: #TODO
        if bad_word in dirs: #TODO
        if bad_word in files: #TODO