Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Q: Script to remove lproj files?

Q: Script to remove lproj files?
Thread Tools
jgift
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Feb 28, 2005, 07:21 PM
 
The Finder Find doesn't seem to be able to search within .apps, even when given a specific directory, so I was thinking of a shell script taht I can daisy chain. ie.

find all french.lproj in /Applications and delete
find all russian.lproj...
etc.

I know Youpi and other apps exist. Thanks.
     
[APi]TheMan
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Mar 1, 2005, 01:04 AM
 
Popular topic. The exact command had escaped me until I did a simple search on google. This should work:
Code:
find / \! -name "English.lproj" -name "*.lproj" -type d -exec rm -rf -- { } \; -prune
This works well, but it's not perfect. If you actually run it as root you'll end up deleting a lot of stuff that probably shouldn't be deleted. Just run the following command (with the delete stuff taken out) to see exactly what will be deleted.
Code:
find / \! -name "English.lproj" -name "*.lproj"
Just be careful, some applications may break if you go deleting files all willy nilly! It's only a couple hundred megs anyways

Maybe someone has a better method (or a sweet regular expression, I don't do regex, hah!).
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
jgift  (op)
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Mar 1, 2005, 04:04 AM
 
That's a great start, thanks a lot.
     
wataru
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 22, 2005, 11:15 PM
 
I've been toying with this myself, and if you'd like to know what languages are most common on your system, run
Code:
find / -name "*.lproj" -exec basename {} \; | sort | uniq -c | sort -r
This will find all of the .lproj folders, count them, and list them in order of most to least numerous.
     
[APi]TheMan
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 23, 2005, 06:29 AM
 
Originally Posted by wataru
I've been toying with this myself, and if you'd like to know what languages are most common on your system, run
Code:
find / -name "*.lproj" -exec basename {} \; | sort | uniq -c | sort -r
This will find all of the .lproj folders, count them, and list them in order of most to least numerous.
Hey that's pretty cool, thanks.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
wataru
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 24, 2005, 03:37 AM
 
I played around with this stuff some more and came up with these functions:
Code:
function flproj () { if [[ -d "$1" ]]; then LOC="$1" else LOC="$PWD" fi find "$LOC" -name "*.lproj" -exec basename "{}" \; | sort | uniq -c | sort -r } function rmlproj () { if [[ -d "$1" ]]; then LOC="$1" else echo "USAGE: rmlproj DIR LANG" return 1 fi until [[ -z "$2" ]]; do echo "Deleting all $2.lproj in $LOC" find "$LOC" -name "$2.lproj" -exec rm -rf "{}" \; 2> /dev/null shift done }
Put those in your ~/.profile and you can use them to single out and delete the most numerous .lproj folders.

By the way, what happened to [ code] blocks being non-wrapping and whitespace-preserving?
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:28 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,