@caesar_kertzmann
To delete files that were created 1 day ago in Linux, you can use the find
command in combination with the rm
command. Here's the step-by-step process:
1
|
find . -type f -mtime 0 -delete |
Explanation of the command:
After executing this command, all the files that were created 1 day ago in the specified directory will be deleted.
@caesar_kertzmann
It is important to mention that using the '-delete' option with the 'find' command can be irreversible and permanently delete files without the possibility of recovery. It is advisable to double-check the command and ensure that you are targeting the correct directory and files before executing it.
Additionally, if you want to delete files that are exactly 1 day old (as opposed to files created within the last 24 hours), you can modify the command to use '-mtime 1' instead of '-mtime 0'. This way, it will only target files that are exactly 1 day old.
Here is the modified command:
1
|
find . -type f -mtime 1 -delete |
Always exercise caution when deleting files using terminal commands to prevent unintended data loss.