Skip to content

This is a simple Unix Bash script to delete the old files contained in a folder and keep just the n newest files. The files must have the same prefix in the name.

Notifications You must be signed in to change notification settings

Daniele-montalbano/DeleteOldFiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

DeleteOldFiles

This is a simple Unix Bash script to delete the old files contained in a folder and keep just the n newest files. The files must have the same prefix in the name.

To run the script use this command "DeleteOldFiles.sh FILENAME_PREFIX FILE_NUMBER_TO_KEEP"

For example the command "DeleteOldFiles.sh "./filefolder/filename" 3" will keep the newest 3 files with the name starting with the prefix "filename" cointaned in the folder filefolder.

About

This is a simple Unix Bash script to delete the old files contained in a folder and keep just the n newest files. The files must have the same prefix in the name.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages