2

I'd like to make a folder in my GNU/Linux home directory that behaves somewhat like TMPDIR (usually /tmp or /var/tmp); that is, a folder that deletes its contents on reboot or after they've started gathering cobwebs. What's the best way to go about this?

Note that I do not want to simply move the tmp dir to home.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
Cameron
  • 23
  • 1
  • 3

2 Answers2

6

It doesn't "delete on reboot"; it only exists in RAM in the first place. Mount tmpfs to a directory under your home directory.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
1

Put the following in your user's crontab:

@reboot rm -rf /home/user/path/*
EEAA
  • 108,414
  • 18
  • 172
  • 242