![]() I don't know if the syntax matches up on the BSD versions, etc. For example, 10 files with April 7 - create a zip for april7. Now I need to compress them based on its file creation/modified date. ![]() ![]() This is all using the GNU versions of the utilities. I have a min 30 files in a directory which contains older dates I.e for past 7 days. The grep line prints every line from old.txt that doesn't appear in new.txt - so it will give you a list of directories that contain only files that were last modified more than 30 days ago. Gzip is the utility provided by Operating system linux, unix for gzip the files and reduce the size of the files with compression method or algorithms. The second command does the same but with every file modified less than 30 days ago, and puts them into another file, new.txt. The first command outputs the path of every file modified more than 30 days ago (in find's -printf - at least with the GNU find on my system - %h prints the whole path except for the actual filename), then sorts those and gets rid of any duplicates, and puts the whole thing into a file called old.txt. Here, dot (.) - Indicates the current directory. mtime 30 -print The above command will find and display the older files which are older than 30 day in the current working directory. type f -mtime -30 -printf '%h\n' | sort | uniq > new.txt Find And Delete Files Older Than X days In Linux First, let us find out the files older than X days, for example 30 days. ![]() type f -mtime 30 -printf '%h\n' | sort | uniq > old.txtÄŻind. Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells With over 10 pre-installed distros to choose from, the worry-free installation life is here Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use. It's probably possible to do this without creating files using process substitution or something, but here's a quick-and-dirty solution: find.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |