<p>You can't do this natively in AWS EFS.  You can move it to cheaper storage natively in EFS by setting up <code>Lifecycle Management</code> to move the files last accessed X days ago to Infrequently Accessed (IA) EFS storage.  This will reduce your storage cost but not eliminate them.  This feature will also move the file back if they are accessed.  See the reference below for more details.</p>
<p>You could run a command like the find below to find files not accessed for 30 days and delete them.  NOTE: this will take up a lot of CPU cycles depending on the amount of files in the path.  YMMV.</p>
<pre><code>find /path/to/efs/* -atime +30 -exec rm {} \;
</code></pre>
<p><strong>References</strong><br />
<a href="https://aws.amazon.com/efs/features/infrequent-access" rel="nofollow noreferrer">EFS Infrequent Access</a><br />
<a href="https://www.cyberciti.biz/faq/howto-finding-files-by-date/" rel="nofollow noreferrer">Finding Files by Access Modification Date/Time</a></p>

CC BY-SA 4.0
2022-02-03T15:13:46.300Z
2022-02-03T15:13:46.300Z
kenlukas
<p>I would like to create an online painter web app.</p>
<p>The app would allow users to draw anything they like and save their drawings on the server.</p>
<p>However, many &quot;guest&quot; users may just come and draw some random strokes then never use those randomly-made drawings.</p>
<p>But I have to kept the files because some user may want to get their drawings a few days later.</p>
<p>So is it possible to set a logic for A</p>

<amazon-efs>
Is it possible to ask AWS-EFS to automatically remove those files that never been read in a period of time?
AGamePlayer
# Is it possible to ask AWS-EFS to automatically remove those files that never been read in a period of time?

(Asked by: username_0 on 2022-02-01)

I would like to create an online painter web app.

The app would allow users to draw anything they like and save their drawings on the server.

However, many "guest" users may just come and draw some random strokes then never use those randomly-made drawings.

But I have to kept the files because some user may want to get their drawings a few days later.

So is it possible to set a logic for A

**Tags:** amazon-efs


---

## 1 answers

### Answer by username_1 on 2022-02-03. Score: 3

You can't do this natively in AWS EFS.  You can move it to cheaper storage natively in EFS by setting up Lifecycle Management to move the files last accessed X days ago to Infrequently Accessed (IA) EFS storage.  This will reduce your storage cost but not eliminate them.  This feature will also move the file back if they are accessed.  See the reference below for more details.
You could run a command like the find below to find files not accessed for 30 days and delete them.  NOTE: this will take up a lot of CPU cycles depending on the amount of files in the path.  YMMV.
find /path/to/efs/* -atime +30 -exec rm {} \;

References
EFS Infrequent Access
Finding Files by Access Modification Date/Time


---

