This topic was automatically generated from Slack. You can find the original thread here.
Is there any way to view the /tmp filestorage and/or view how much storage is used manually?
This topic was automatically generated from Slack. You can find the original thread here.
Is there any way to view the /tmp filestorage and/or view how much storage is used manually?
How can I clear the /tmp folder using python?
To clear the /tmp
folder using Python, you can use the following code snippet: import os import shutil for filename in os.listdir('/tmp'): file_path = os.path.join('/tmp', filename) try: if os.path.isfile(file_path) or os.path.islink(file_path): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) except Exception as e: print(f'Failed to delete {file_path}. Reason: {e}')
This code will iterate through the files and directories in the /tmp
folder and delete them. Please note that the /tmp
directory storage is not unlimited and may be wiped or may not exist between workflow executions.
We also use bash steps quite extensively to interface with the /tmp
directory.
Just one command to clear it: rm -rf /tmp/*
Oh nice I didn’t even know there were bash steps avaliable