Posted 7 years ago
·
Author
In an effort to get a basic understanding of Python I'm going to write code to perform basic tasks related to IMVU that I already know how to do in other languages.
Below I am going to share a few code snippets with you that you can learn from. Each piece of code is fully functional on its own and can be saved to a file and ran via the python console. As long as you have python installed you should be able to run them.
Requirements:
1) Python
2) Python IDE/Text Editor (I'm using Notepad++)
Open your IMVU cache folder
Basic cache cleaner
This is a basic cache cleaner, it goes through your cache folder deleting all of the files and folders.
Basic cache cleaner v2
This is another basic cache cleaner. Except instead of going through the cache folders and files it just deletes the entire cache folder at once and then replaces it with an empty folder
Below I am going to share a few code snippets with you that you can learn from. Each piece of code is fully functional on its own and can be saved to a file and ran via the python console. As long as you have python installed you should be able to run them.
Requirements:
1) Python
2) Python IDE/Text Editor (I'm using Notepad++)
Open your IMVU cache folder
import subprocess, os
if os.getenv('APPDATA') is not None:
subprocess.Popen('explorer "' + os.getenv('APPDATA') + '\IMVU\HttpCache\"')
Basic cache cleaner
This is a basic cache cleaner, it goes through your cache folder deleting all of the files and folders.
import os, shutil
cachePath = os.path.join(os.getenv('APPDATA') + '\\IMVU\\HttpCache\\')
if os.path.exists(cachePath):
print cachePath
for cacheFile in os.listdir(cachePath):
cacheFilePath = os.path.join(cachePath, cacheFile)
try:
if os.path.isfile(cacheFilePath):
os.unlink(cacheFilePath)
elif os.path.isdir(cacheFilePath): shutil.rmtree(cacheFilePath)
except Exception as e:
print(e)
else:
print 'IMVU Cache Folder Not Found'
raw_input()
Basic cache cleaner v2
This is another basic cache cleaner. Except instead of going through the cache folders and files it just deletes the entire cache folder at once and then replaces it with an empty folder
import os, shutil
cachePath = os.path.join(os.getenv('APPDATA') + '\\IMVU\\HttpCache\\')
if os.path.exists(cachePath):
print cachePath
try:
if os.path.isdir(cachePath):
shutil.rmtree(cachePath)
os.makedirs(cachePath)
except Exception as e:
print(e)
else:
print 'IMVU Cache Folder Not Found'
raw_input()