Jump to content

Hello dudes, I don't know if this is the correct place to put this but I'm trying to backup my user folder but first i'm trying to delete shit out of it taht I don't need like cache/temp files. My question is...Is there a batch/PS script I can create that will seek any folder in my user directory with the word cache or temp within it's name and delete the files within them? I am at work rn so anything to try when I get home will be appreciated.

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1118525-cache-files/
Share on other sites

Link to post
Share on other sites

6 minutes ago, mariushm said:

Have you tried Disk Cleanup  (start , run/search , disk cleanup , right click and run as adminstrator)

 

Also Piriform CCleaner : https://www.ccleaner.com/ccleaner/download

 

I thought that just cleared basic things like browser and system temp

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1118525-cache-files/#findComment-13005580
Share on other sites

Link to post
Share on other sites

13 hours ago, MrMcMuffinJr said:

Is there a batch/PS script I can create that will seek any folder in my user directory with the word cache or temp within it's name and delete the files within them? I am at work rn so anything to try when I get home will be appreciated.

PS> Remove-Item -path c:\Users\* -include *cache*,*temp* -recurse -force -whatif

Should be something like this... the '-whatif' will make it show you what it would have deleted so you can test it. Remove the '-whatif' to actually delete stuff. Will need to be run from Powershell with admin. priv.

 

Link to comment
https://linustechtips.com/topic/1118525-cache-files/#findComment-13007242
Share on other sites

Link to post
Share on other sites

12 hours ago, WWicket said:

PS> Remove-Item -path c:\Users\* -include *cache*,*temp* -recurse -force -whatif

Should be something like this... the '-whatif' will make it show you what it would have deleted so you can test it. Remove the '-whatif' to actually delete stuff. Will need to be run from Powershell with admin. priv.

 

Not really on topic but I just like how Windows went with whatif rather than dry-run

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/1118525-cache-files/#findComment-13008605
Share on other sites

Link to post
Share on other sites

On 10/30/2019 at 12:30 PM, vorticalbox said:

Not really on topic but I just like how Windows went with whatif rather than dry-run

I'll try when I get home

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1118525-cache-files/#findComment-13011173
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×