Packages zip remove script
#1
Hi there Im trying to make a script that will count and remove the old zip files from the packages folder.
Currently Im just trying to get the yesno dialog window up with the file count, but having no joy, could anyone help as to where its going wrong.
Possibly a module I havnt imported?

Code:
import os
import xbmc
import xbmcgui
import zipfile
import shutil
import time
import datetime
import sys

dir_to_count = xbmc.translatePath('special://home/addons/packages')

def count_files(dir_to_count):
    x = 0
    for root, dirs, files in os.walk(dir_to_count):
        for f in files:
            x = x+1
    YESNOWINDOW = xbmcgui.Dialog().yesno(
        "Your package folder has been Checked",
        "You have", x, "zip files in that directory",
        "Would you like to free up some space",
        "and remove these files?",
        "No Thanks",
        "Yes Please")
    if YESNOWINDOW:
        '''run the remove_zip script'''
        xbmcgui.Dialog().ok(
            "Running the removal script",
            "Thats it. All done",
            "Click OK to exit",
            "")
        
    else:
        xbmcgui.Dialog().ok(
            "Not running the removal script"            "
            "Nothing on your system has changed",
            "If you are low on space, you can",
            "run this program again at any time")
Reply

Logout Mark Read Team Forum Stats Members Help
Packages zip remove script0
This forum uses Lukasz Tkacz MyBB addons.