|
|
#21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
Grrr... it happened again, two at once this time.
I downloaded Watchfile.
I don't know how to do this. In fact I can't find any invisible files that include "icon" in the name using Spotlight.
Some of the files that lose their icons are stored in Documents/Games Upstairs/Psychic Game. Their are 5 files in there all with the same custom icon. Then...
i.e.: % watchfile ~/Documents/Games Upstairs/Psychic Game.* (right?) Do I need to keep Terminal open for this to write to?
And where in the syntax do I append the "/a" for a beep? As you can see I will need some detailed help notes to track this puppy. But that sound like the right way to proceed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#22 |
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
The 2 files that lost icons are the 2 Excel files I was using last before shutting down. I remember that when I quit Excel I did a Save All rather than saving both individually before choosing Quit. In case that data spurs any imaginations.
|
|
|
|
|
|
#23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
You don't want to use Spotlight for this. You need to use Terminal. Read at least the first section of this Unix FAQ Also read the section on navigating and listing folder contents. There's no point in going further if you haven't located these "Icon" files.
Not quite. First off, since there are spaces in some of the folder names, you'll need to put the path inside quotes - see the Unix FAQ. And thus it would be best to use /Users/your_username instead of ~ Is "Psychic Game" the name of a folder? If so, you want the last part to be "/*" instead of ".*": watchfile "/Users/your_username/Documents/Games Upstairs/Psychic Game/"* Test this out with the 'ls' command first. Doing something like: ls "/Users/your_username/Documents/Games Upstairs/Psychic Game/"* should list the files you want.
Yes
Immediately after the line that says: print_msg($filename, "Changed: $mods", 1); you could add a new line: print "\a"; # make a beep
__________________
hayne.net/macosx.html |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#24 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Well, you should immediately try this experiment again. Save an Excel file that has a custom icon. Does the icon get lost upon restart? Then open a few Excel files that have custom icons and do Save All. Do the files get lost upon restart?
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#25 | |||||||||||||||||||
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
Here's the input/output from my terminal command. I've highlighted some things to make asking a few questions easier. Last login: Thu Feb 16 13:11:42 on console Welcome to Darwin! Upstairs-Computer:~ robertkinleyjohnson$ ls "/Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/"* /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of Campus Mapped /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of The Houses /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of mapping the campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of re-mapping the campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of re-re- mapping campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of re-re-re mapping camp /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of victorian plans sorti /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Backup of ??? Psychic Game-Player /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Berkley Mapping.xls /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Berkley Maps Workbook.xls /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Berkley.xls /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Campus Mapped /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Icon? /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/James' Settite Possibility /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/The Houses /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/The Houses Top Elevation /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/The Houses copy /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Workbook1.xls /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/making the little buildings /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/mapping the campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/mapping the campus copy /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/re-mapping the campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/re-re- mapping campus /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/re-re-re mapping campus copy /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/victorian plans sorting /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/??? Psychic Game-Player Notes /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/??? Psychic Game-Player Notes copy Upstairs-Computer:~ robertkinleyjohnson$ 3 colors, 3 questions so you can see what I am and am not grasping. ls "/Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/"* From reading the section on navigating and listing folder contents*, I would have thought this syntax would have been more like: ls /Users/robertkinleyjohnson/Documents/"Games Upstairs"/"Psychic Game"/* /Users/robertkinleyjohnson/Documents/Games Upstairs/Psychic Game/Icon? Why is there only 1 "Icon" file when several of these files have custom icons, albeit all the same custom icon? And I was not expecting "Icon" with a question mark; does that mean something is wrong? ??? Psychic Game-Player Notes ??? Psychic Game-Player Notes copy The 3 ?'s here correspond to "•" in the file names: • Psychic Game-Player Notes copy. I bet these ?'s are not related to the Icon question mark. Right? |
|||||||||||||||||||
|
|
|
|
|
#26 |
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
Here's the current data on the save vs. save all.
Just now, opening 1 file, changing something, saving. The icon was ok. Restart, no icon. Opening 2 files, changing/saving, quitting, save all, no icons before even restarting. I need more data to overcome the small sample size but so far any pattern with last night's save all seem contradictory. |
|
|
|
|
|
#27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
There are often lots of variations that will work.
I think that one file contains all of the custom icons for files in that folder. The question mark in its name is because the name of the file has 5 characters - the last character is (if I recall correctly) a "\r" character - something that doesn't display properly. This is normal.
Right
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#28 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Due to what I pointed out above about the one "Icon\r" file per folder, it is probably best if you do your troubleshooting experiments with folders that have only one file that has a custom icon.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#29 |
|
All Star
Join Date: Jan 2002
Location: New York, NY
Posts: 587
|
I don't think that's true about the "Icon?" file being for all custom icons for files within that folder; it's just the custom icon for the folder itself. A folder can't have a resource fork, right, so there would be no other place to put its icon, like how a volume's icon is located in a file called .VolumeIcon.icns at the volume's root.
If you paste a custom icon onto a folder (a folder containing a file with its own custom icon), then you delete the newly created "Icon?", the custom icon for the file will remain, while the custom icon for the folder will be gone. |
|
|
|
|
|
#30 | ||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
Good point.
Seems likely. I just did ls on a folder with 2 different custom icons. It only listed the 1 "icon?" I have created a new sub-folder in the Psychic Game folder and placed an experimental copy of one of the custom iconned Excel files. So if I am right my filepath should be: /Users/robertkinleyjohnson/Documents/"Games Upstairs"/"Psychic Game"/"Terminal Icon Testing"/* Right? Now where should I put the (Watchfile) script in a folder that is in your shell's execution path? And how do I make the (Watchfile) script file executable (with chmod +x)? |
||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#31 |
|
MVP
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
|
I agree with Franko - I don't get Icon files when the file icon is changed.
If I change a file icon the file modification date is altered, although its size remains constant. I thought custom icons were stored in the resource fork - although I don't understand why my file sizes remain constant. Does the 'ls' command only show the size of the data fork? I don't know an answer - but is there some reason why Avalon can't have resource forks? Which would explain why the icons go. Last edited by bramley; 02-16-2006 at 03:47 PM. |
|
|
|
|
|
#32 |
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
On my second (downstairs) computer running 10.2.8 I am not having these problems. But when I experiment with a new folder and the ls command, I get interesting results.
I start with an empty folder with no special icon. ls to that folder lists nothing. I put an icon on it and ls lists "icon?" I remove the icon and ls still says icon. Start over with a new folder. no icon. add a file with no custom icon. ls sees file, mentions no icon. Add custom icon to file, ls still lists no icon with the file. So where do we think the custom icons for nonfolder file items live? I have of course no idea. |
|
|
|
|
|
#33 | ||||||||||||||||||||||||||||||||||||||||||||||
|
All Star
Join Date: Jan 2002
Location: New York, NY
Posts: 587
|
Remove the icon how? By rm'ing the Icon? file in Terminal or getting info on the file and hitting Delete on the keyboard? Because I noticed a difference between the two methods, too. My only guess would be that, in the latter case, rather than just delete the custom icon file, the OS just places the "generic" icon in the Icon? file.
File icons are stored in their resource fork. Those aren't visible via ls (not by just doing `ls`, anyway; there might be a way to show them using a flag, but I don't know). |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#34 |
|
MVP
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
|
A resource fork can be displayed with ls by typing
"ls -l foobar.extension/rsrc" The command works on one file only. I don't know if watchfile can be made to watch the resource fork in the same way as for an 'ordinary file.' Maybe Avalon could try and see. |
|
|
|
|
|
#35 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Okay, I stand corrected. What I said was partly just a guess, partly a vague recollection. What you say makes more sense (as well as being empirically verified )
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#36 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Although that works, I recall reading that that method is now deprecated and the "correct" method is: ls -l foobar.extension/..namedfork/rsrc
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#37 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Yes - I just tried using 'watchfile' on a resource fork and it works fine: Code:
% watchfile ~/Junk/Test/foo.html/..namedfork/rsrc Thu Feb 16 16:13:24 2006: /Users/fred/Junk/Test/foo.html/..namedfork/rsrc: info stored -rw-r--r-- 1 fred fred 49128 Feb 10 08:56 /Users/fred/Junk/Test/foo.html/..namedfork/rsrc # (in another Terminal window): cp /dev/null foo.html/..namedfork/rsrc Thu Feb 16 16:13:44 2006: /Users/fred/Junk/Test/foo.html/..namedfork/rsrc: Changed: size mtime ctime -rw-r--r-- 1 fred fred 0 Feb 16 16:13 /Users/fred/Junk/Test/foo.html/..namedfork/rsrc
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#38 | |||||||||||||||||||||||
|
MVP
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
|
I was going to say that I've just noticed plenty of whining system.log messages saying 'foobar.extension/rsrc' is depreciated. |
|||||||||||||||||||||||
|
|
|
|
|
#39 | ||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Oct 2005
Posts: 179
|
I stepped out to buy groceries. I'll answer several posts at once.
I used the Get Info cut method to restore the default. My guess is that unless the system is specifically told to clean up the old file that it will remain. I suspect rather than putting the default icon in the icon file and effectively making it a custom icon, that there is a flag or when the system accesses and find the file blank that it puts in the default as a true default. But it doesn't actually matter.
Since I'm just learning I'm all for learning the "correct" ways. I have to say I dislike that in something that seems as Assembler language-like as Unix/Terminal does, that "there are often lots of variations that will work." As Hayne said comparing ls /Users/robertkinleyjohnson/Documents/"Games Upstairs"/"Psychic Game"/* to the syntax ls "/Users/your_username/Documents/Games Upstairs/Psychic Game/"*. But that's just me. So, um, I use ls -l foobar.extension/..namedfork/rsrc to find the path of the custom icon's fork.... How? ls -l foobar.extension/users/kinleyjohnson/robertkinleyjohnson/documents/"Games Folder"/"Psychic Game"/"Terminal Icon Testing"/name_of_excel_file/rsrc? Then after you correct on what I typed above, back to my previous ignorances: Where should I put the (Watchfile) script in a folder that is in your shell's execution path? And how do I make the (Watchfile) script file executable (with chmod +x)? Thanks for everyone's help. |
||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#40 | ||||||||||||||||||||||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
No - it would be more like: ls -l /Users/kinleyjohnson/robertkinleyjohnson/Documents/"Games Folder"/"Psychic Game"/"Terminal Icon Testing"/name_of_excel_file/..namedfork/rsrc
These questions are answered in the Unix FAQ referred to above. E.g. make a new folder under your home folder and call it something like "Scripts" (or whatever you like) and then follow the directions in the FAQ to make your PATH include that folder. Or just don't worry about the PATH variable for the moment and just use the full pathname when you run the script. E.g. if it is called "watchfile" and is in a folder named "Scripts" under your home folder, you can run it with the full path: ~/Scripts/watchfile
__________________
hayne.net/macosx.html |
||||||||||||||||||||||||||||||||||||||||||
|
|
|
![]() |
|
|