Sponsored Content
Operating Systems Linux compare files in the system with last modified date Post 302141538 by bsandeep_80 on Friday 19th of October 2007 02:58:43 PM
Old 10-19-2007
compare files in the system with last modified date

HI,

I have some files in my Linux machine that are very old and occupy a HUGe amount of space. I am trying to delete these files from the system so that it will be easy for me to add some files. I would like to know if this can done through a Perl or a shell script.

What i want to do is i want to compare the files with the current date stamp and list all the files that are were untouched for more than TWO years.

Please can some whe help me on how this can be done.

I am new to Linux and need Guidance on this.

Thanks,
Sandeep
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Create a list of files that were modified after a given date.

Hello Mates! I'm kinda new to unix and need to a solve a problem. Input: date Situation: With the given date I need to find a list of all such files starting from a given path that were modified after the given date. I experimented with the "find" with "-newer" but did not quite get it... (4 Replies)
Discussion started by: rkka
4 Replies

2. Shell Programming and Scripting

Compare date from db2 table to yesterday's Unix system date

I am currently running the following Korn shell script which works fine: #!/usr/bin/ksh count=`db2 -x "select count(*) from schema.tablename"` echo "count" I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies

3. UNIX for Dummies Questions & Answers

Find last modified date for many files

Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated! If possible, I would like to sort this output and have... (5 Replies)
Discussion started by: MichaelH3947
5 Replies

4. UNIX for Dummies Questions & Answers

Number of files in a directory modified on a date

Hi How to list all the files in a directory that are modified on a particular date? Also need to know the count,i.e number of files modified on a particular date. Thanks Ashok (1 Reply)
Discussion started by: ashok.k
1 Replies

5. UNIX for Dummies Questions & Answers

mv folders/files without changing modified date?

Hi all, I'm using Red Hat Linux and want to move some folders and files around but not change the modified date. Is this possible? I know cp has a -p flag which seems to do what I want, but this is a large volume of data so copying and deleting would not be feasible. (13 Replies)
Discussion started by: Annorax
13 Replies

6. Shell Programming and Scripting

Adding days to system date then compare to a date

Hi! I am trying to read a file and every line has a specific date as one of its fields. I want to take that date and compare it to the date today plus 6 days. while read line do date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD if ; then ...proceed commands ... (1 Reply)
Discussion started by: kokoro
1 Replies

7. Shell Programming and Scripting

How to get the files which has modified date as yesterday and before?

Hi All, Can you please help me to get only the files which has the modified date as yesterday and before? Thanks in advance! Regards, Velava.S (4 Replies)
Discussion started by: velava
4 Replies

8. Shell Programming and Scripting

Compare the system date with date from a text file

I get the date that's inside a text file and assigned it to a variable. When I grep the date from the file, I get this, Not After : Jul 28 14:09:57 2017 GMT So I only crop out the date, with this command echo $dateFile | cut -d ':' -f 2,4The result would be Jul 28 14:57 2017 GMT How do I... (3 Replies)
Discussion started by: Loc
3 Replies

9. UNIX for Beginners Questions & Answers

Compare date in .txt with system date and remove if it's lesser than system date

Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt . I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies

10. Answers to Frequently Asked Questions

Compare date in .txt with system date and remove if it's lesser than system date

I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies
MKFS(8) 						      System Manager's Manual							   MKFS(8)

NAME
mkfs, mkext - archive or update a file system SYNOPSIS
disk/mkfs [-aprv] [-n name] [-s source] [-u users] [-z n] proto ... disk/mkext [-d name] [-u] [-h] [-v] file ... DESCRIPTION
Mkfs copies files from the file tree source (default /) to a kfs file system (see kfs(4)). The kfs service is mounted on /n/kfs, and /adm/users is copied to /n/kfs/adm/users. The proto files are read, and any files specified in them that are out of date are copied to /n/kfs. Each line of the proto file specifies a file to copy. Indentation is significant, with each level of indentation corresponding to a level in the file tree. Fields within a line are separated by white space. The first field is the last path element in the destination file tree. The second field specifies the permissions. The third field is the owner of the file, and the fourth is the group owning the file. The fifth field is the name of the file from which to copy; this file is read from the current name space, not the source file tree. All fields except the first are optional. Names beginning with a are expanded as environment variables. If the first file specified in a directory is all of the files in that directory are copied. If the first file is all of the files are copied, and all subdirectories are recursively copied. Mkfs copies only those files that are out of date. Such a file is first copied into a temporary file in the appropriate destination direc- tory and then moved to the destination file. Files in the kfs file system that are not specified in the proto file are not updated and not removed. The options to mkfs are: a Instead of writing to a kfs file system, write an archive file to standard output, suitable for mkext. All files in proto, not just those out of date, are archived. n name Use kfs.name as the name of the kfs service (default kfs). p Update the permissions of a file even if it is up to date. r Copy all files. s source Copy from files rooted at the tree source. u users Copy file users into /adm/users in the new system. v Print the names of all of the files as they are copied. z n Copy files assuming kfs block n (default 1024) bytes long. If a block contains only 0-valued bytes, it is not copied. Mkext unpacks archive files made by the -a option of mkfs. The -d option specifies a directory (default /n/kfs) to serve as the root of the unpacked file system. The -u option, to be used only when initializing a new fs(4) file system, sets the owners of the files created to correspond to those in the archive and restores the modification times of the files. (This is only permitted at the initial load of the files into a file system.) Each file on the command line is unpacked in one pass through the archive. If the file is a directory, all files and subdirectories of that directory are also unpacked. When a file is unpacked, the entire path is created if it does not exist. If no files are specified, the entire archive is unpacked; in this case, missing intermediate directories are not created. The -v option prints the names and sizes of files as they are extracted; -h prints headers for the files on standard output instead of unpacking the files. EXAMPLES
Make an archive to establish a new file system: disk/mkfs -a -u files/adm.users -s dist proto > arch Unpack that archive onto a new file system: srv il!newfs mount -c /srv/il!newfs /n/newfs disk/mkext -u -d /n/newfs < arch FILES
/lib/proto directory of prototype files. /lib/proto/portproto generic prototype file. SOURCE
/sys/src/cmd/disk/mkfs.c /sys/src/cmd/disk/mkext.c SEE ALSO
prep(8), kfscmd(8), wren(3), pip(8) MKFS(8)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy