24.10.2021, 19:02 fxtd

If you are a freelancer or work in a small studio, you may not have an automatic cleanup and backup system for projects. This greatly affects the free space on the storage. And cleaning up previous projects takes a long time when you don’t have enough space for the current project.

The best way to avoid this is to have a specific project structure and use a backup process. During this process, unnecessary data such as geometry caches that can be recovered from scenes and unnecessary data versions are automatically deleted according to the project structure and some specific rules.

If you don’t follow this way, cleaning up the project will be a very slow process because, literally, you have to check all the project files manually.

If you use a more or less correct data storage process, you will have many versions of the file sequences at the end of the project. They usually take up most of the space that can be cleaned up before backing up. In this case, we can clean up the project in a semi-automatic mode.

If you have many folders with version numbers in their names (e.g. v001, v002, v01, v02, etc.), this Python script will help you. It shows folders containing multiple versions. You just need to run the script from the command line:

python c:\showVersions.py M:\PROJECT

where M:\PROJECT is the root of the project you want to start cleaning up from.

You can also use additional arguments, for example:

python c:\showVersions.py M:\PROJECT render 2 5.5GB

where render is an optional keyword. It is used to filter the paths of the found folders. For example, you can search for versions only in the render folder, or you can search for versions in the folders of a specific artist: in this case, you need to use his name as a keyword. 2 – the minimum allowed number of versions, for example, if you want the found folders to contain more than 2 versions. 5.5GB is the minimum size of versions found. If you don’t want to search for small size versions, you can use this filter. GB in this argument are required characters, you can use a different spelling of the number: 0.001GB, 10GB, .5GB, etc.

Additional arguments can be used optionally and in any order.

The result of the script is as follows:

python C:\showVersions.py M:\LAST_PROJECT render 3 20.5GB

M:\LAST_PROJECT\SHOTS\SCENE02\SCENE02_0030\render\flood
Versions size: 31.92 GB
v001
v002
v003
v004

M:\LAST_PROJECT\SHOTS\SCENE04\SCENE04_0020\render\water
Versions size: 89.27 GB
v001
v002
v003
v004
v005

M:\LAST_PROJECT\SHOTS\SCENE03\SCENE03_0040\render\destruction
Versions size: 32.74 GB
v001
v003
v004
v005

M:\LAST_PROJECT\SHOTS\SCENE03\SCENE03_0060\render\base
Versions size: 22.81 GB
v001
v002
v003
v004
v005

Press Enter to continue...

Now we can check the displayed paths and remove unnecessary versions, for example, all but the last one. I always do it manually because I have a rule: never delete files with a script.