Sponsored Content
Full Discussion: Delete 3 oldest files
Top Forums Shell Programming and Scripting Delete 3 oldest files Post 303021580 by Don Cragun on Monday 13th of August 2018 04:58:47 AM
Old 08-13-2018
Quote:
Originally Posted by drew77
I have already told you that I am NOT an admin.
You had not said anything about being an admin or about not being an admin in this thread until post #7 in this thread. Please do not assume that everyone has read all of your posts in all of the threads in which you have posted a comment when replying to one of your threads. Assume that each thread is complete on its own without needing to know what has been discussed in other threads unless a link to those other threads has been included. (This includes ALWAYS telling us what operating system and shell you're using when starting a thread in this forum.)
Quote:
Originally Posted by drew77
Yes.
A lot is depending on being able to restore. :-)
When you ask us how to delete the 3 oldest files in a directory, you're likely to get suggestions that will tell you how to delete the 3 oldest files in a directory (no matter how many files that leaves untouched).

If you ask us how to delete backup files that are more than six months old, you're likely to get suggestions that will tell you how to delete backup files that are more than six months (or more than 180 days) old.

Not mentioning that you're working on backup files (until post #5 in a thread) when there seems to be a hidden requirement to keep a certain number of backups or backups for a certain period of time, makes it unlikely that any early suggestions you get will be of much help.

You have a lot of context that guides you when you're trying to decide what you want to do. If you don't share that context with us when you ask for help, it is unlikely that the help we try to provide will actually help meet your unstated requirements.

Please help us help you!
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oldest files

Anyone know of a way to list all of the files including subdirectories and list them as oldest first? (2 Replies)
Discussion started by: 2dumb
2 Replies

2. Shell Programming and Scripting

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 ... (2 Replies)
Discussion started by: scarfake
2 Replies

3. Shell Programming and Scripting

delete oldest images from remote server

Would someone please give me a script that will remove all but the newest jpg image from my server. i am uploading a new image every 10 seconds form a live web cam Also i do not know who to make a shell script work i am new to all this so i need all the help you could give Thank You very much (1 Reply)
Discussion started by: Destined
1 Replies

4. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

5. Shell Programming and Scripting

Moving files only by oldest file one at a time

Hi I am want to create a script where the file gets moved from the current folder to a folder transfer based on the oldest first. This script should run one file at a time using a loop. I want it as a loop because I want to do some processing while I have one file. Can anyone guide me on this? (2 Replies)
Discussion started by: chamajid
2 Replies

6. UNIX for Dummies Questions & Answers

To delete the oldest files in a file when file count in the folder exceeds 7

Hi All, I need to delete the oldest file in folder when the file count in the folder exceed 6 ( i have a process that puts the source files into this folder ) E.x : Folder : /data/opt/backup 01/01/2012 a.txt 01/02/2012 b.txt ... (1 Reply)
Discussion started by: akshay01987
1 Replies

7. Shell Programming and Scripting

Keeping oldest backup files?

I need a script to clean up the files on our backup system. I was hoping this would be simple for someone to put together for me. I'm sure I could do it, but I'm a bash n00b so it would definitely not be efficiently or within a reasonable amount of time. :( Requirements: - Root of backups... (3 Replies)
Discussion started by: Calab
3 Replies

8. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

9. UNIX for Advanced & Expert Users

Finding oldest files

There are some 25,000 files in 7,000 directories in my source library and I am trying to find oldest files. I am running this find: find /usr/mysrc -name "*." -type f -mtime +8000 -exec ls -l {} 2>/dev/null and playing with the days parameter for mtime, but the output is not sorted... (3 Replies)
Discussion started by: migurus
3 Replies

10. Shell Programming and Scripting

Delete oldest folder based on folder named as date

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
comb(1) 						      General Commands Manual							   comb(1)

NAME
comb - combine SCCS deltas SYNOPSIS
SID] list] file ... DESCRIPTION
The command generates a shell procedure (see sh(1)) which, when run, reconstructs the given SCCS files. The reconstructed files are usu- ally smaller than the original files. Arguments can be specified in any order, but all options apply to all named SCCS files. If a direc- tory is named, behaves as though each file in the directory were specified as a named file, except that non-SCCS files (last component of the path name does not begin with and unreadable files are silently ignored. If a name of is given, the standard input is read; each line of the standard input is taken to be the name of an SCCS file to be processed; non-SCCS files and unreadable files are silently ignored. The generated shell procedure is written on the standard output. Options recognizes the following options. Each is explained as if only one named file is to be processed, but the effects of any option apply independently to each named file. The SCCS IDentification string (SID) of the oldest delta to be preserved. All older deltas are discarded in the recon- structed file. A list of deltas to be preserved (see get(1) for the syntax of a list). All other deltas are discarded. For each generated, this option causes the reconstructed file to be accessed at the release of the delta to be created, other- wise the reconstructed file would be accessed at the most recent ancestor. Use of the option can decrease the size of the reconstructed SCCS file. It can also alter the shape of the delta tree of the original file. This option causes to generate a shell procedure which, when run, produces a report giving, for each file: the file name, size (in blocks) after combining, original size (also in blocks), and percentage change computed by: 100 x (original - combined) / original It is recommended that this option be used before any SCCS files are actually combined to determine exactly how much space is saved by the combining process. If no options are specified, preserves only leaf deltas and the minimal number of ancestors needed to preserve the tree. EXTERNAL INFLUENCES
International Code Set Support Single- and multi-byte character code sets are supported. DIAGNOSTICS
Use sccshelp(1) for explanations. EXAMPLES
The command: creates a shell script named which if executed, creates a new using only the deltas from the old The script overwrites the old thus, it might be wise to copy the original elsewhere. Here is an example of typical technique: WARNINGS
may rearrange the shape of the tree of deltas. Combining files may or may not save space; in fact, it is possible for the reconstructed file to actually be larger than the original. FILES
Temporary file Temporary file SEE ALSO
admin(1), delta(1), get(1), sccshelp(1), prs(1), sh(1), sccsfile(4). comb(1)
All times are GMT -4. The time now is 07:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy