!Scrap - a beginners guide
Aaron dives head first into the RISC OS !Scrap directory...
I'm quite sure all RISCWorld readers know that all RISCOS computers have a scrap directory. This lives on the hard disk and provides a temporary storage space for applications. Over time this scrap directory will gradually get filled up until it is taking up a significant proportion of the hard disk space. You may be tempted to simply delete the contents of scrap to free up the space. Although this at first may seem like a good idea as this article will show just deleting the entire contents of scrap could have unforeseen repercussions.
Where is scrap?
On a modern RISCOS computer the scrap directory will live inside of the computer's boot sequence. Its normal location is:
There two ways of getting inside the scrap directory. Firstly, you can hold down the Shift key and double click on !Boot to open it. You can then double click on the Resources directory and finally hold down Shift and double click on !Scrap. This is the method we are going to use in this article.
The alternative method of getting inside !Scrap is to open the Utilities directory in your main hard disk and double click on the !ShowScrap application. If you find that your computer does not have a !ShowScrap application then you can use the copy provided in the Software directory of this issue of RISCWorld. This looks like a much easier and simpler method, but, crucially it will only show you the part of !Scrap that is currently being used. So we will bypass this method for now.
The structure of !Scrap?
Having opened !Scrap you will probably find something like this:
The only part we are interested in is the ScrapDirs directory. The other files are used to set up !Scrap so the computer can use it correctly and shouldn't be altered.
If you then go and open the ScrapDirs directory you would perhaps expect to find a collection of files for various application (exactly the same as shown by using !ShowScrap). Well you won't. Instead you will quite likely find something that looks like this:
This looks rather nasty doesn't it? At this point many users investigating what's going on inside !Scrap would give up. However it's actually quite easy to see what's going on. Each of these directories is set up for use with a particular configuration of your network, assuming you have one. If you don't have any networking set up on your machine then you may find you only have one or two directories. You may have the ScrapDir folder that is used by legacy applications and you may also have one other scrap directory. This should normally be called ID000!000. This will contain all your Scrap files - so you can skip the rest of this section and move on to the What's in Scrap? part of this article.
Your computer will normally only be using one of these strangely named folders. Every time a change is made to the network setup of the computer RISC OS will make a new scrap subdirectory. This will always start with the letters ID and will have a number after it. So we need to find out which one is being used. The currently used directory is referenced by the Wimp$ScrapDir system variable. In the software section of this issue I have included an Obey file called WhichScrap. If you double click on this it will open a text window showing you which of the scrap directories is currently in use.
Having identified the directory in use we can now have a poke around the other directories. You may find that some of them are empty, or may contain a number of files. At this point it's worth seeing how much disc space each of these directories is taking up. Press Menu over each directory, go past the file name on the filer menu and click on Count. If you are short of disc space you can delete any of these directories that are not being used. However do not under any circumstances delete the one currently being used (as reported by WhichScrap) or the directory called ScrapDir.
If the computer ever needs any of these directories again it will simple create them as needed, but it won't create ScrapDir itself. So be warned. If you aren't sure about what you are doing then don't delete anything. Now having cleared out any unused scrap directories let's move on to the one that's being used.
What's in Scrap?
If you open the scrap directory being used (in my case ID4401a8c0) then you will see something like this:
Each of the folders correspond to an application. You may think that you can just delete everything and that's the end of it, but I really do not advise deleting items without checking them first. The reason for this is that although you might think that the directories only contain temporary files in reality they may also contains custom settings for applications.
It's worth explaining how this situation came about as you would expect that an applications preferences (or choices) would be stored in the choices section of your boot sequence. However when RISC OS was widely used in schools and RISC OS 3.1 was the latest version of RISC OS many computers would be "locked" to prevent changes. On a locked machine only two directories could be written to. These were the "Public" directory on the root of the harddisc as used by Acorn Access (ShareFS) and the !Scrap directory. So, as a software developer you really only had one sensible place for your application to save its preferences, and that was in !Scrap. If you tried to save your choices elsewhere, even inside your own application, then an error would occur. Since the educational market at that time was very significant for RISC OS sales it was sensible to make sure that your application worked on as many school machines as possible.
You may well find that a number of applications, especially older ones, save their choices inside !Scrap. So if you delete items without checking you could find that all your applications preferences have changed. So, now the history lesson is over with, let's see what we can safely get rid of.
Inside !Scrap there are some "special" directories that you should be careful with. For example the directory Printers may contain the printer settings for your computer and since it's unlikely to take up much disc space should probably be best left alone. In the example screen shot above you will also see a DWorks directory. As I mentioned earlier some older applications save their choices inside !Scrap. The presence of a DWorks directory means that at some point this copy of RISC OS has run an older style DrawWorks. I happen to know that I am now only using a modern DrawWorks that saves its preferences elsewhere (in Choices), so I can delete this directory without worrying.
I can also delete most of the other directories in here without too much concern because I know which applications I use and which ones don't matter. You may well find scrap directories on your machine for applications that you never use, or used once a long time ago. The reason for this is that typically an application will create a Scrap directory for itself on a machine the first time its run. So even if you have just loaded an application once just to see what it is like you may well find it has created its own directory inside !Scrap.
As well as the Printers directory inside scrap there is also one other special case that you should be aware of. The WWW directory will store files related to your web browser. I don't recommend deleting files in here unless you are absolutely sure you know what you are doing. If you do want to clear out the cache of files downloaded from the Internet (which will be pretty much everything you have ever looked at) then your browser should have an option to do this for you. Different browsers work in different ways so the contents of the WWW directory will depend on your particular RISC OS setup. You can (if you feel brave) delete the the entire WWW directory (which can free up several MB of disc space) but you may lose some cookies and other important items, it's up to you if you want to take the risk.
So you should now almost be in a position to delete the directories you don't want. However before deleting anything have one final look around to see if there are any files you might want to keep. For example, some months ago you might have been using !Paint to edit a sprite, until !Paint crashed on you. If you are lucky you will find a copy of the sprite that got "lost" inside the Paint directory. You may also find some older drawfiles inside the Draw directory.
Once you have done a final scan through to check for anything useful you can start deleting files. You might be tempted to go into each directory and delete each file by hand. However it's much quicker to just delete the particular directory for the application concerned. As we have seen earlier the application will just create the directory again if it needs it. As a final thought if your machine has a CD writer you could always burn a copy of !Scrap to CD as a backup just in case something important gets lost.
Having gone through !Scrap you will hopefully have recovered some significant harddisc space as well as found some files that you thought had been lost forever. Plus you now have a much better understanding of how this important part of RISC OS works.