How to remove purgeable files in macOS and reclaim free space
After deleting Files on a macOS SSD, free space is not directly available.
This behaviour is intended to save the read/write cycles of the SSD.
Unless you begin writing new files, which require the purgeable space, macOS begins to free up space.
Sometimes you want to install Applications, which fails due to not enough space, although you actually removed enough files.
With this Terminal Command you can remove the purgeable space
What is does, is generating one big file as big as the purgeable space, wait few seconds and deleting it again, so that the OS has to really clear it.
Open Terminal and paste the following one liner and hit Enter
gb="$(df -h / | grep /dev/ | awk '{print $4}' | sed 's/[^0-9]//g')"; echo gb=$gb; dd if=/dev/zero of=/tmp/gb_filename bs=1024 count=${gb}000000; sleep 600; rm -f /tmp/gb_filename
After Unpacking the zip Files of my Flickr Data Export, I found the Metadata in json files and Photos without the Original Modification Date.
Using exiftool on mac I managed to Re-Import the EXIF Data and Adjust the Date to the Date of the Photo taken
1. Install exiftool command
https://sourceforge.net/projects/exiftool
2. adjust the folder path in the dir variable containing your unpacked flickr export data
3. Run This One Line Command in Terminal and it will pick the matching id from the json file and apply to the related photo:
dir="/Users/islam/Downloads/my_flickr_export"; for json in $(find "${dir}" -name "*.json" -type f); do id="$(basename "${json}" | cut -d. -f1 | cut -d_ -f2)"; photo="$(find "${dir}" -name "*${id}*" -not -name "*.json" -type f)"; exiftool -m -d "%Y-%m-%d %H:%M:%S" -tagsfromfile "${json}" "-Keywords<tags" "-Subject<tags" "-Caption-Abstract<name" "-ImageDescription<description" "-DateTimeOriginal<date_taken" -ext "*" -overwrite_original -progress "-filemodifydate<date_taken" "-filecreatedate<date_taken" --ext json "${photo}"; done
Finally, you can delete json Files
dir="/Users/islam/Downloads/my_flickr_export"; find "${dir}" -name "*.json" -type f -delete
I have similar working solution for Google Photos takeout too.
After Unpacking the zip Files of my Google Photos Takeout, I found the Metadata in json files and Photos without the Original Modification Date.
Using exiftool on mac I managed to Re-Import the EXIF Data and Adjust the Date to the Date of the Photo taken
1. Install exiftool command
https://sourceforge.net/projects/exiftool
2. adjust the folder path in the dir variable containing your unpacked Google Photos export data
3. Run This One Line Command in Terminal and it will and apply the json File Info to the related photo:
dir="/Users/islam/Downloads/my_google_photos"; exiftool -m -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress "-filemodifydate<PhotoTakenTimeTimestamp" "-filecreatedate<PhotoTakenTimeTimestamp" --ext json "${dir}"
Finally, you can delete json Files
dir="/Users/islam/Downloads/my_google_photos"; find "${dir}" -name "*.json" -type f -delete
I have similar working solution for Flickr Export too.
Google Takeout Link: https://takeout.google.com/
Mac:
1. Install ArchiCAD 22 on your machine
2. Activate ArchiCAD by educational License and copy education.lic from /Users/Shared/ARCHICAD/AC_22_GER/ to a different location
Silent Install procedure:
1.
sudo /Volumes/ARCHICAD\ 22/ARCHICAD\ 22\ Installer.app/Contents/MacOS/installbuilder.sh --mode unattended --desktopshortcut 0 --dockshortcut 0 --enableautomaticupdate 0 --rebootAnswer 0
2. copy education.lic back to /Users/Shared/ARCHICAD/AC_22_GER/
More Install Parametrs are provided here:
sudo /Volumes/ARCHICAD\ 22/ARCHICAD\ 22\ Installer.app/Contents/MacOS/installbuilder.sh --help
3. Silent Uninstall:
"/Applications/Graphisoft/ARCHICAD 22/Uninstall.AC/Uninstall.app/Contents/MacOS/installbuilder.sh" --mode unattended
Windows:
1. Install ArchiCAD 22 on your machine
2. Activate ArchiCAD by educational License and copy education.lic from C:\ProgramData\ARCHICAD\AC_22_GER\ to a different location
Silent Install procedure:
1.
ARCHICAD-22-GER-3009-1.6.exe --mode unattended --desktopshortcut 0 --enableautomaticupdate 0
2. copy education.lic back to C:\ProgramData\ARCHICAD\AC_22_GER\
More Install Parametrs are provided here:
ARCHICAD-22-GER-3009-1.6.exe --help
3. Silent Uninstall:
"C:\Program Files\GRAPHISOFT\ARCHICAD 22\Uninstall.AC\Uninstall.exe" --mode unattended
The default sort command on Mac OS X Command Line (Terminal) doesn't provide sorting Version Numbers
For Example
Command:
echo -ne "17.0.9\n17.0.11\n17.0.8" | sort -n
Result:
17.0.11 17.0.8 17.0.9
Conclusion:The numerical and alphabetical sort on mac Terminal always sorts the "1" before the "9", leading to sort the "17.0.11" lower in number than "17.0.8"
Because of this issue, I created this Bash File "sort-version.sh" to make the numerical sort correctly.
Command:
./sort-version.sh $(echo -ne "17.0.9\n17.0.11\n17.0.8")
Result:
17.0.8 17.0.9 17.0.11
Usage: sort-version.sh numeric-values
example sort-version.sh 17.0.9 17.0.11 17.0.8
sort-version.sh
Source-Code: sort-version.sh
#!/bin/bash #Islam Adel #2014-03-27 First Lines #2014-03-31 Added help text #Sort Version Numbers # Tested on Mac OS X 10.9 # 9 digits held by "#" (sorted before numbers in alphabetical order) # Translate each separated input into 9 digited field (17.0.8 --> ######17.########0.########8 # sort # Translate back ####################################### #Readme #Usage: sort-version.sh numeric-version-numbers # Use "." separated version numbers as input arguments # example: sort-version.sh $(echo -ne "17.0.9\n17.0.11\n17.0.8") # OR: sort-version.sh 17.0.7 17.0.11 17.0.8 ####################################### #SET Global Variables here #SET full lenght 9x # full="#########" #SET Default delimiter here IFS=" " #default? #IFS=$' \t\n' #backup old IFS #OLDIFS=$IFS #define input version numbers #echo ${@} p=${@} #exit error code 1 if no arguments defined if [[ -z ${@} ]]; then exit 1; fi ####sample input #p="17.0.8 #17.0.11 #17.0.9" ##################################### #List all input Values for i in $(echo ${p}) do x= #Trim the dots between the values and treat separately for k in $(echo ${i} | sed 'y/./\n/') do #count the number of characters in version number #trim this number from the full length of ######### #set the a new value for the version number with a fixed length #combine the divided numbers by dots previously to one string #add the dots again x=${x}${full:$(echo ${k} | wc -m)}${k}. #a dot remains at the end done #divide each version number by new line #trim the last dot #add the previous version to a new line #only if a previous version is available if [[ ! -z ${y} ]];then y="${y} $(echo ${x} | sed 's/.$//')" else y=$(echo ${x} | sed 's/.$//') fi done #SET New delimiter as new line break IFS='\n' #Now sort Alphabetically and remove the fixed length echo ${y} | sort | sed 's/#//g' #Restore IFS? #IFS=$OLDIFS exit 0
Für optimalen Benutzerservice auf dieser Webseite verwenden wir Cookies.
Durch die Verwendung unserer Webseite erklären Sie sich mit der Verwendung von Cookies einverstanden. Mehr...
Cookies sind kleine Textdateien unserer Webseite, die auf Ihrem Computer vom Browser gespeichert werden wenn sich dieser mit dem Internet verbindet. Cookies können verwendet werden, um Daten zu sammeln und zu speichern um Ihnen die Verwendung der Webseite angenehmer zu gestalten. Sie können von dieser oder anderen Seiten stammen.
Es gibt verschiedene Typen von Cookies:
Mit der Benutzung dieser Webseite haben wir Sie über Cookies informiert und um Ihr Einverständnis gebeten (Artikel 22, Gesetz 34/2002 der Information Society Services). Diese dienen dazu, den Service, den wir zur Verfügung stellen, zu verbessern. Wir verwenden Google Analytics, um anonyme statistische Informationen zu erfassen wie z.B. die Anzahl der Besucher. Cookies von Google Analytics unterliegen der Steuerung und den Datenschutz-Bestimmungen von Google Analytics. Auf Wunsch können Sie Cookies von Google Analytics deaktivieren.
Sie können Cookies auch generell abschalten, folgen Sie dazu den Informationen Ihres Browserherstellers.