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
  • 244,070
  • 43
  • 506
  • 972
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,939
  • 6
  • 79
  • 84
1

Put the following in your user's crontab:

@reboot rm -rf /home/user/path/*
EEAA
  • 109,363
  • 18
  • 175
  • 245