Sponsored Content
Top Forums Shell Programming and Scripting RE:backup files older then 24hrs to a new directory . Post 302070294 by blowtorch on Monday 3rd of April 2006 09:57:10 PM
Old 04-03-2006
Jim, I believe there is some confusion regarding the mtime parameter. +0 stands for older than one day, +1 would stand for older than 2 days. Check this out:
Code:
# date
Tue Apr  4 04:28:16 IST 2006
# ls -ltr
:
:
-rw-r--r--   1 root       sys              0 Apr  3 04:20 testfile
-rw-r--r--   1 root       sys           1300 Apr  3 23:58 fs.c
-rw-r--r--   1 root       sys            583 Apr  4 04:08 freesp.c
-rw-r--r--   1 root       sys            971 Apr  4 04:11 daemon.c
-rwxr-xr-x   1 root       sys          28672 Apr  4 04:11 a.out
-rwxr-xr-x   1 root       sys          24576 Apr  4 04:11 daemon
-rw-r--r--   1 root       sys            139 Mar 22 12:56 ./t1.c
-rwxr-xr-x   1 root       sys             38 Mar 31 08:05 ./shell/test.sh
drwxr-xr-x   2 root       sys           8192 Mar 31 08:05 ./shell
-rw-r--r--   1 root       sys              0 Apr  3 04:20 ./testfile
# find . -mtime +0 |xargs ls -ldtr|more
:
-rw-r--r--   1 root       sys            139 Mar 22 12:56 ./t1.c
-rwxr-xr-x   1 root       sys             38 Mar 31 08:05 ./shell/test.sh
drwxr-xr-x   2 root       sys           8192 Mar 31 08:05 ./shell
-rw-r--r--   1 root       sys              0 Apr  3 04:20 ./testfile
# find . -mtime +1 |xargs ls -ldtr|more
:
-rw-r--r--   1 root       sys            139 Mar 22 12:56 ./t1.c
-rwxr-xr-x   1 root       sys             38 Mar 31 08:05 ./shell/test.sh
drwxr-xr-x   2 root       sys           8192 Mar 31 08:05 ./shell

Note that the file testfile shows up on using +0 and not on using +1. Check Perderabo's last post in this thread.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix command/s to find files older than 2 hours in a directory

I need to write a script to find files older than 2 hours in set of direcotries and list them ina mail. I know find command ti list files greater/lesser than days but i need to do it for hours. Any input. (6 Replies)
Discussion started by: Presanna
6 Replies

2. Shell Programming and Scripting

delete files older than 5 minutes in directory (recursively)

sorry guys can some please give me a hint how to achieve this in a slick oneliner? delete files older than 5 minutes in specified directory (recursively) peace (3 Replies)
Discussion started by: scarfake
3 Replies

3. Shell Programming and Scripting

Find files in a directory which are older than 2 hrs

hi all, I need to find files in a directory which are older than N hrs... n can be 1,2,3,.. etc when tried using -mtime option it gives all the files in the last 24hrs from the current time . please help me out on this .. thanks (8 Replies)
Discussion started by: sparks
8 Replies

4. Shell Programming and Scripting

Removing files older than one week in a directory

Hi, I need a shell script to remove the files older than a week in a directoy and if necessary to zip the files. (2 Replies)
Discussion started by: sudhakaryadav
2 Replies

5. Shell Programming and Scripting

Delete the files older than 3 weeks in a particular directory.

Hi, Friends, I am writing a script to delete all the files which are there for more than 3 weeks. I have tried this : find /home/appl/backup -type f -mtime +21 -exec rm -f {} \; But i am not sure if it deletes only the files in specified directory or all the directorinies in the provieded... (3 Replies)
Discussion started by: rajsharma
3 Replies

6. Shell Programming and Scripting

Delete files older than 10 Days in a directory

Hi All I want to remove the files with name like data*.csv from the directory older than 10 days. If there is no files exists to remove older than 10 days, It should not do anything. Thanks Jo (9 Replies)
Discussion started by: rajeshjohney
9 Replies

7. AIX

Want to delete directory, subdirectories and all files which are older than 7 days

how do i remove sub directories of a directory and all files which are older than 7 days by a single command in AIX. pls help me. I am using command as #find /gpfs1/home/vinod/hpc/ -depth -type d -mtime +7 -exec rm -rf {} \; so i want to delete all sub directories and all files from the... (1 Reply)
Discussion started by: vinodkmpal
1 Replies

8. Shell Programming and Scripting

Deleting files and directory's older than 3 months

I have a qnap TS259 that is running ubuntu. Have successfully setup back scripts that are initiated by cron. I would like to create a couple scrypts that would operate on the recycle bins for both drives. Just want to be able to run the script manually that would walk through both directories... (13 Replies)
Discussion started by: mackconsult
13 Replies

9. Shell Programming and Scripting

How to move the files older than x days with similar directory structure?

Hello, I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure. for example: /XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt I know about find /XYZ -type f -mtime +14... (3 Replies)
Discussion started by: prvnrk
3 Replies

10. Linux

Finding files older than x days within directory with spaces

Hi, I am trying to run a command that finds all files over x amount of days, issue is one of the directories has spaces within it. find /files/target directory/*/* -type f -mtime +60 When running the above the usual error message is thrown back + find '/files/target\' 'directory/*/*' -type... (1 Reply)
Discussion started by: Ads89
1 Replies
GZEXE(1)						      General Commands Manual							  GZEXE(1)

NAME
gzexe - compress executable files in place SYNOPSIS
gzexe name ... DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a penalty in performance). For example if you execute ``gzexe /usr/bin/gdb'' it will create the following two files: -rwxr-xr-x 1 root root 1026675 Jun 7 13:53 /usr/bin/gdb -rwxr-xr-x 1 root root 2304524 May 30 13:02 /usr/bin/gdb~ /usr/bin/gdb~ is the original file and /usr/bin/gdb is the self-uncompressing executable file. You can remove /usr/bin/gdb~ once you are sure that /usr/bin/gdb works properly. This utility is most useful on systems with very small disks. OPTIONS
-d Decompress the given executables instead of compressing them. SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the PATH environment variable to find gzip and some standard utilities (basename, chmod, ln, mkdir, mktemp, rm, sleep, and tail). BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases, using chmod or chown. GZEXE(1)
All times are GMT -4. The time now is 04:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy