Blow away file contents while leaving attributes
Say you have a folder full of GIF files that you have converted to
BeOS icons. You want to upload this icon set to BeBits, but your users will only ever use the icon attributes, so why make them download the file contents?
You could create a new folder full of zero-byte files and transfer the attributes one by one, but this really is the sort of drudge work computers were supposed to liberate us from! The following script will change every file in the current directory into a zero- byte file with nothing but attributes, so try not to use it in the directory where you keep your financial reports …
#!/bin/sh # for file in `ls`; do echo processing $file # using file2xyz2 as a dummy file - use a # different name if you actually have such a file! touch file2xyz2 cp file2xyz2 $file rm -f file2xyz2 done
Now all you need to do is change the MIME types of your icon files into either “generic file” (application/octet-stream actually) or “application/x-vnd.Icon”, so that ShowImage won’t try to display it when the user double-clicks the file. You can do this in one go by selecting all the icons in the directory, then rightclicking on one and selecting FileType from the add-ons menu.
That’s it! Zip ’em up and upload to your favourite BeOS depository. On a small collection of 52 icons, my zip file size went down from 72 to 35 KB using this technique.
Posted in Scripting
(comments are closed).