Posts

Showing posts from August, 2019

Delete Files and Folders Older Than X Days

Removing files / folders older than X days. This post contains a batch file, and a Powershell script that will do this. Batch File: @echo off :: set folder path set dump_path=c:\shares\dump :: set min age of files and folders to delete set max_days=7 :: remove files from %dump_path% forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd /c del /q @path" :: remove sub directories from %dump_path% forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path" Powershell: # set folder path $dump_path = "C:\shares\dump" # set min age of files $max_days = "-7" # get the current date $curr_date = Get-Date # determine how far back we go based on current date $del_date = $curr_date.AddDays($max_days) # delete the files Get-ChildItem $dump_path -Recurse | Where-Object { $_.LastWriteTime -lt $del_date } | Remove-Item

How can I list P4 changes since a specific changelist

//depot/branches/branch_name/...@12345,#head  specifies a range between changelist 12345 and head/latest. //depot/branches/branch_name/...@12345,23456  specifies a range between changelist 12345 and 23456. //depot/branches/branch_name/...@2012/08/01,@2012/08/21  specifies a range between two dates.