Skip to content

Instantly share code, notes, and snippets.

@anchnk
Created August 8, 2018 08:40
Show Gist options
  • Save anchnk/9e6b923aad396b01825305db7d6c02b3 to your computer and use it in GitHub Desktop.
Save anchnk/9e6b923aad396b01825305db7d6c02b3 to your computer and use it in GitHub Desktop.
Command to move files to Ubuntu trash for files older than:

Command to move files to Ubuntu trash for files older than:

find . -type f -name '*.txt' -mtime +7 -exec gio trash {} \;

Where:

  • find .: search current folder
  • -type f: limit search to files
  • -name '*.txt*': limit search to files that have .txt extension
  • -mtime +7: last modification date is >= 7 days
  • -exec gio trash {} \;: move matching elements to Ubuntu trash

Note: {} represents the elements and ; closes the command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment