Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Force HP scanners to automatically clear temporary files Scanners
I have an HP All-in-one printer/scanner, but I assume this will be useful for other HP scanner models as well. I was mighty annoyed by the fact that the scanner leaves a temp file every time you use it. The temp file can be found in a subfolder of your Home folder (in: ~/Documents » All-in-One Data Folder » Archive, to be precise). I experimented with shell scripting to automatically clean out that folder periodically, but with less than satisfying results.

Then the following solution suddenly occurred to me: I deleted the folder Archive, and replaced it with a symbolic link to the system temp folder. For the non Terminal-savvy, this is the procedure in Terminal:
cd /Users/your_username/Documents/All-in-One Data Folder
ln -s /tmp Archive
Make sure to name the link exactly the same as the original folder where the temp files are saved (the the last word on the above line will be the name of the link). Now the scanner saves its temp files in /tmp, without the scanner applet even being aware of it. The folder /tmp is cleaned out on each restart, so I never have to bother with deleting those files myself anymore.
    •    
  • Currently 2.33 / 5
  You rated: 3 / 5 (12 votes cast)
 
[14,620 views]  

Force HP scanners to automatically clear temporary files | 8 comments | Create New Account
Click here to return to the 'Force HP scanners to automatically clear temporary files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Force HP scanners to automatically clear temporary files
Authored by: squawky on Jul 03, '07 08:32:59AM

I have an older HP All-in-One (Officejet d145), and the process described in this hint did not work for me.

I tried linking the Archive folder to a folder on an external drive, and the scanning software refused to scan because it could not recognize the link (I tried creating the link as an alias in Finder as well as trying the ln -s command).

For me, though, the Archive folder contains both finished scans and temporary files -- the temporary files get deleted automatically unless the scan terminates unexpectedly. I wouldn't want to automatically dump the contents of this folder to /tmp -- I just wanted the darn things someplace other than my home directory.

The preview images get dumped to the /tmp directory automatically (yes, even when scanning without a preview window) -- at 1-2 Mb apiece, this needs cleaning out occasionally.

---
Somebody wake up Hicks.



[ Reply to This | # ]
Force HP scanners to automatically clear temporary files
Authored by: mchagers on Sep 18, '07 02:01:51AM

The link only works if it's created as a symbolic link in the terminal as per described in my original tip. A finder alias is a different beast apparently, and the scanner software doesn't recognize it as a valid folder.



[ Reply to This | # ]
A better suggestion
Authored by: lincd0 on Jul 03, '07 09:28:34AM

There are some problems with this. First, depending on how you set NSUmask, other users may be able to read the files you create in /tmp. Second, by indiscriminately creating temporary files with predictable names, you're allowing for a possible exploit. Finally, if you use FileVault or otherwise encrypt your /Users directory, you're losing that protection by writing personal data to the root device.

A better solution would be to download the excellent, and free, application Lingon, which will guide you through the process of creating a launchd user agent to delete the temp files when you log in. Take advantage of the features of OS X instead of defeating them with this insecure hack.



[ Reply to This | # ]
A better suggestion
Authored by: davidas on Jul 03, '07 11:00:41AM
Hi. Thanks to you and the original poster! It's timely. I just took delivery of a new HP all-in-one today, so your post sounds like a good point. I downloaded lingon and took a look, only to realize I don't know enough to take advantage of your suggestion for using it. I hope it's not an imposition, but could you give me an orientation tip on what kind of agent or daemon should be constructed? It's important to me because I've had problems before with temp file buildup in MS Office apps, Omniweb and some others and would like to avoid the resulting probs, if possible. Any help is greatly appreciated! All the best, David

---
David Smith

[ Reply to This | # ]

A better suggestion
Authored by: mchagers on Sep 18, '07 01:57:04AM

It's true that this is insecure: if you are paranoid about anyone seeing what you scanned in, then don't use my tip.

However in my case, since I don't allow remote connections, and since whatever I scanned in is usually still lying around on my desk anyway, the point is moot.

I'm also at a loss why using a third party app to clean out a folder is somehow a better way of "making use of Mac OSX built-in capabilities" than using OSX' unix underpinnings to create a symlink.



[ Reply to This | # ]
Short Lingon tutorial
Authored by: lincd0 on Jul 03, '07 01:48:59PM

Launch Lingon. Click on the Assistant icon in the toolbar. The radio button labeled Run a job at startup should be selected in Step 1; if not, select it. Click Next. In Step 2, you can enter anything you want (no spaces) for the label. The checkbox labeled Launch only when I log in should be selected; if not, select it. Click Next. In Step 3, enter /bin/rm -rf ~/somefolder/*, where somefolder is the relative path to the folder whose contents you want to delete at login. The '~' represents your home directory. For example, if you are user 'foo' and the target directory is '/Users/foo/Documents/bar', you would put /bin/rm -rf ~/Documents/bar/*. Click Create.

You will see your new launchd item in the My Agents table, with a green icon in the first column indicating that it's active. To edit it, double click the entry. To delete, select it, click the Unload icon in the toolbar, then hit the Delete key.

WARNING: This procedure will destroy data. If you get it wrong, it may destroy data other than what was intended. Do not follow these instructions unless you fully understand what's going on and have satisfied yourself that they're correct. If you have no experience with the shell or launchd, try this in a test account first.

[ Reply to This | # ]

Short Lingon tutorial
Authored by: davidas on Jul 04, '07 03:39:55AM

Thanks, lincd0. Much appreciated. Now I've got a way to vector what I don't know with what I do. I'm not going to try anything till I've worked this out. The hack isn't an essential priority, so I can take my time with it and try to get it right the first time, as you warn.

Best regards,























































































---
David Smith



[ Reply to This | # ]
Force HP scanners to automatically clear temporary files
Authored by: Excalibur7388 on Jul 03, '07 11:24:56PM

It'd just be easier to create an Automator work flow. That's what I did =)

---
-Thinks Different



[ Reply to This | # ]