How do I delete a file from year in Linux?

How do I delete a file from year in Linux?

  1. find /path/to/files -type f -mtime +365 -delete would be easier. –
  2. -delete isn’t in my aix find so I’m not accustomed to using it.
  3. find … –
  4. Also, it’s a good idea to use — in case the first file name begins with a – (although you can guarantee it won’t happen if the directory passed to find doesn’t begin with a – ). –

How do I delete a 2018 file in Linux?

A linux directory (or folder) can be empty, or it can contain files. If To delete a directory in Linux, use one of the following two commands: rmdir command – removes empty directories/folders. rm command – removes a directory/folder along with all the files and sub-directories in it.

How to delete all files older than one year?

By the time, many files are still on my system and I don’t need them anymore, so how to delete all files that are one year old at least? /path/to/files* is the path to the files. -mtime is used to specify the number of days old that the file is. +365 will find files older than 365 days which is one year

How to delete files based on year Unix Stack Exchange?

Replace B by m below to use the modification time rather than the birth time. Run it once without -delete first to make sure these are the files you want. The command above will also delete files in subdirectories; if this is not desired, add -mindepth 1 -maxdepth 1 after the directory name.

How to delete files with last modified date?

/d to select files with a last modified date. -365 simply means a year ago. /c to indicate the command to execute each file found in the search. The command string needs to be wrapped up in double quotes. “cmd /c echo @file” is the default command if not specified.

How to delete files that were created in 2009?

I need to delete all files in a directory that were created in 2009. What command can I use to do that? Most filesystems don’t store the creation time of a file, so the best you can do is check the last time the file was modified.