|
|
#1 |
|
Prospect
Join Date: Aug 2003
Posts: 45
|
How do I delete every alias on a disk
Seems like a strange request, but I have a problem on my backup disk with psync in that it seems to be confused by alias files on the target disk, so I want to
Delete all aliases on a the target (backup disk) before I do the backup. How would I do this? |
|
|
|
|
|
#2 |
|
Triple-A Player
Join Date: Mar 2003
Location: Silver Spring, MD, USA
Posts: 57
|
If, as I understand it, Mac OS X aliases are UNIX-style symlinks, you should be able to delete all aliases on a drive (or, in a directory) by opening a terminal window and typing:
Code:
find /path/ -type l -exec rm -f {} \;
This translates to "find files in the directory /path/ (and all subdirectories) of type symbolic link (Alias). For each you find, execute the remove command, and don't ask me for confirmation." Keep in mind that UNIX-style removing will not move files to the Trashcan, so be careful! And make sure to get your path right, or you could wind up deleting all aliases on your computer, which would royally screw up iPhoto libraries, etc etc. I don't know what the path would be for a second Mac HD, as I don't have one... but the "mount" command should provide clues. If you just run Code:
find /path/ -type l Hope this helps! |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
the shell command find, above, is only going to find unix style symbolic links.
finder style aliases are not findable from the shell, without considerable evaluation. so, use the finder find facility to find finder aliaii ;] there, you can select the results and command-delete them to the trash |
|
|
|
|
|
#4 | |||||||||||||||||||
|
Prospect
Join Date: Aug 2003
Posts: 45
|
Re: UNIX Solution
Thanks! I'd forgotten, but I'd used a similar command before to remove certain small files. No trouble with the path [/Volumes/backup/] |
|||||||||||||||||||
|
|
|
|
|
#5 | |||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,941
|
file alias != symbolic link
Ah - but they aren't! Mac OS aliases are conceptually like sym-links but they are implemented completely independently. See overview in Apple Developer Doc Hence, as Merv has already explained, you can't detect them with ' type l' in 'find'. Last edited by hayne; 08-12-2003 at 02:20 AM. |
|||||||||||||||||||
|
|
|
|
|
#6 |
|
Prospect
Join Date: May 2012
Posts: 5
|
I'll bump this old thread by saying how to do it from the terminal (Spotlight MUST be enabled on the drive and any folders/paths excluded from Spotlight will NOT be covered):
mdfind "kMDItemKind == 'Alias'" -onlyin ~/Desktop You can use any valid unix path for -onlyin to limit search to subfolders of that path, or remove the command to search every drive that spotlight indexes. Note: mdfind "kMDItemKind == 'Alias'" -onlyin / mdfind "kMDItemKind == 'Alias'" Are NOT equivalent. The first one ONLY searches the root drive. The second one searches EVERY indexed drive/volume in the computer. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|