Last active
January 1, 2020 08:48
-
-
Save welsonla/0e4c4a818abfae0400a4087b54e81c43 to your computer and use it in GitHub Desktop.
Revisions
-
welsonla revised this gist
Jan 1, 2020 . No changes.There are no files selected for viewing
-
welsonla created this gist
Jan 1, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #/bin/bash #diskspace info puts "Current Diskspace info:" puts "---------" puts %x[df -lh /] #list localsnapshots puts "\n\n---------" list = %x[tmutil listlocalsnapshots /] puts list #delete snapshots puts "\n\n---------" puts "Start delete snapshots:" matches = list.scan(/\d{4}-\d{2}-\d{2}-\d{6}/) matches.each_with_index{|snapshoot,index| puts "delete the listlocalsnapshots #{snapshoot}" sh = "tmutil deletelocalsnapshots #{snapshoot}" system(sh) } #diskspace info after delete snapshot puts puts "\n\n---------" puts "Diskspace info after delete snapshots:" puts %x[df -lh /]