05-20-2008
sort files by date, delete oldest, if total size bigger than
hello people
i need your help please
i want to achieve the following with the simplest, most efficient shell-tools:
i have a directory with a lot of files from users.
the script should check which partition the dir is on
if the partition with the directory is more than 90% full
sort files in the directory by date last touched
then delete the 50 oldest files
i have done this in PHP but it is pretty slow now by growing number of files on a 2TB drive.
and in Shell-scripting i am not good at all to achieve this
id be very happy if one of the professionals here could help me.
if you want i write you a little funny poem as a thank you
peace, Tony
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I'm newbie to Unix. I'd like to count the total size of those files in my directory by date. For example, files on this period 05/01/08 - 05/31/08. If possible can we count by byte instead of kb.
if I use $ du - ks , it will add up all files in the dir.
thanks,
Helen (5 Replies)
Discussion started by: helen008
5 Replies
2. Shell Programming and Scripting
Hello ,
I have to write a crontab line make a check on a file and, if bigger than 2Gb, to stop apache daemon, delete the file and restart apache .
Someone have suggestions ?
Thanks (2 Replies)
Discussion started by: gogol_bordello
2 Replies
3. Shell Programming and Scripting
Hi,
I am trying to get the total file size for certain files per directory.
I am using
find /DirectoryPath -name '*.dta' -exec ls -l {} \; | awk '{ print $NF ": " $5 }' > /users/cergun/My\ Documents/dtafiles.txt
but this lists all the files in the directories.
I need the total... (9 Replies)
Discussion started by: cergun
9 Replies
4. UNIX for Dummies Questions & Answers
as we use du - sh *.frm
In This command It will show the list of files and size
But I want the Total size that these files in directory with extension .frm
How can we do This (6 Replies)
Discussion started by: kaushik02018
6 Replies
5. Shell Programming and Scripting
Hello all,
I need to do scripts total up the size in selected extension file for example motion.mov and segmentation.avi is in Label Media. For file info.doc and calc.xls in Label Document.
I need output will be like this:
count 1
Media,,2 GB
count 2
Document,,4 GB
My problem is,... (16 Replies)
Discussion started by: sheikh76
16 Replies
6. Shell Programming and Scripting
I have used an script to reduce the size of multiples pdf. This script creates files with the same name but with different extension. The extension of the compressed files is xpdf. Sometimes the "compressed" xpdf are bigger than the "uncompressed"pdf. I want to create a zsh script to compare each... (1 Reply)
Discussion started by: AMDx64BT
1 Replies
7. Shell Programming and Scripting
Hi
I have some set of files for a particular date. What is the command that I need to put in for finding the total size of all the files for that particular date. The following command is fetching me the size of all individual files seperately
du -h *20101010*
16M file1.20101010
120K... (10 Replies)
Discussion started by: bobby1015
10 Replies
8. Shell Programming and Scripting
I have file listed like below
-rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz
-rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz
-rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz
-rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz
-rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz
I... (5 Replies)
Discussion started by: krish2014
5 Replies
9. Shell Programming and Scripting
Hi,
I have a script doing backup to synology server, the script create new folder each day with the date as being folder name i.e. 2018-07-30. Just before creating the new folder I want the script to find the oldest folder from the list and delete it including its content.
for example... (3 Replies)
Discussion started by: humble_learner
3 Replies
10. Shell Programming and Scripting
Trying to delete my 3 oldest files.
I am learning despite the many questions.
This shows the files.
ls -1r /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Ubuntu_Documents.zip_* | tail -n+6adding this on did not work.
| -exec rm {}------ Post updated at 05:43 PM ------
This works, but I... (15 Replies)
Discussion started by: drew77
15 Replies
LEARN ABOUT MOJAVE
update_dyld_shared_cache
update_dyld_shared_cache(1) BSD General Commands Manual update_dyld_shared_cache(1)
NAME
update_dyld_shared_cache -- Updates dyld's shared cache
SYNOPSIS
update_dyld_shared_cache [-root directory] [-overlay directory] [-arch arch] [-force] [-debug] [-universal_boot]
DESCRIPTION
update_dyld_shared_cache ensures that dyld's shared cache is up-to-date. This tool is normally only run by Apple's Installer and Software
Update, as they are the only official ways for OS dylibs to be updated. But if for some reason you used another mechanism to alter an OS
dylib, you should manually run update_dyld_shared_cache.
Note that the new cache does not take effect until the OS is rebooted.
The dyld shared cache is mapped by dyld into a process at launch time. Later, when loading any mach-o image, dyld will first check if is in
the share cache, and if it is will use that pre-bound version instead of opening, mapping, and binding the original file. This results in
significant performance improvements to launch time.
update_dyld_shared_cache scans the directory /System/Library/Receipts/ for .bom files which list all files installed. From that info it cre-
ates the set of OS dylibs to build into the dyld cache.
update_dyld_shared_cache builds a separate cache file for each architecture. The cache files and a readable text map of the cached are gen-
erated to /var/db/dyld.
You must be root to run this tool.
The options are as follows:
-root directory
This option specifies the root of an OS installation for which dyld's shared cache should be updated. This is used by the In-
staller to update the dyld shared cache in a partition other than the one you into which you are currently booted. The cache
files are created in the var/db/dyld directory of the specified directory. Note: if you are manually doing this, be sure to run
the update_dyld_shared_cache tool that is in the partition being updated. This assures the cache format created will match that
expected when booting off that partition.
-overlay directory
This option specifies the root of a sparse directory tree. When building the dyld shared cache, any corresponding mach-o files
in the sparse directory will override those in the boot partition. This is used by Software Update to build a dyld shared cache
for the update that is about to be installed. The cache files are created in the var/db/dyld directory of the specified direc-
tory.
-arch arch By default update_dyld_shared_cache generates cache files for all architecture that the current machine can execute. You can
override this behavior by specifying one or more -arch options and list exactly which architectures should have their shared
caches updated.
-force This option will cause update_dyld_shared_cache to regenerated the shared cache files even if they appear to be already up-to-
date.
-debug This option prints out additional information about the work being done.
-universal_boot
This option builds caches for all machines.
SEE ALSO
dyld(1)
Darwin June 1, 2017 Darwin