Sponsored Content
Top Forums Shell Programming and Scripting Deleting the contents of a folder older than X hours Post 302296671 by worchyld on Wednesday 11th of March 2009 02:52:47 PM
Old 03-11-2009
Quote:
Originally Posted by Goldorakk
Try this:
Code:
$ find /path/to/data/* -name data -type d -ctime 0 -exec rm -rf {} \;

Smilie
I tried your code twice and it never deleted anything.

But I noticed you used a * at the end of your /data/ and tried in on a previousily mentioned code and it seems to be working;

Code:
find /path/to/inbounddata/data/* -depth -type d ! -name data -ctime 0 -exec /bin/rm -Rf "{}" \;

This deleted the date-named folder created by the following code:

Code:
/usr/bin/unzip -a -o /path/to/inbounddata/traveldata.zip -d /path/to/inbounddata/data/$(date +"%Y-%m-%d")

This seems to have cracked the problem! Yey! (I'm going to do some more testing just to make sure!)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding files older than 2 hours

I want to write a sh script that will find files older than 2 hours and tar them. I've had a look at the find man page but can't see how to do it by hours. Help please. Thanx (1 Reply)
Discussion started by: ianf
1 Replies

2. UNIX for Dummies Questions & Answers

Finding only those files older than 2 hours

I need to write a program that will only remove those files that are older than 2 hours. Is there some variation of find . -mtime ? -name '*' that I can use? Thanks as always for your help. Regards, Dave :) (2 Replies)
Discussion started by: mh53j_fe
2 Replies

3. Shell Programming and Scripting

removing files after 6 hours or older

What is the command to remove files that are generated 6 hours or older? The find and remove tells only how to remove if the file is one day old or more. Appreciate quick reply. Thanks (3 Replies)
Discussion started by: gthokala
3 Replies

4. Solaris

Deleting Files Older than 24 hours

Hi, I am using Solaris Box, I need to delete file(cookies.html) from the path(/usr/temp) which are older than 24 hours(I want in hours, not in days) Can u provide the command for the above query (7 Replies)
Discussion started by: mazhar803
7 Replies

5. AIX

how to find files older than 2 hours

I need help to find files in a directory that are older than 2 hours. Any help would be great. (3 Replies)
Discussion started by: pt14
3 Replies

6. Shell Programming and Scripting

Find files older than 8 hours

I need a script to find files older than 8 hours... I know i can use mmin but the same is not working...the same only support mtime... This is the script i created..but the same is only giving 1 hour old..as I have given dt_H as 1 only...but if i give 8..it can go in -(negative)..how to get the... (5 Replies)
Discussion started by: cotton
5 Replies

7. Shell Programming and Scripting

Deleting files older than 6 hours

Hi All, I am using the below script to find all the files in a folder which are older than 6 hours and delete all those files, but some how I am not getting the required output. find $HOME/Log -type f -name "*.log" -amin +360 -exec rm *.* {} \ can any one please check and let me know... (13 Replies)
Discussion started by: subhasri_2020
13 Replies

8. Shell Programming and Scripting

files older than few hours

Hi All I need to know the command which can be used to list the files which are 3 hours old so that it can be deleted. (3 Replies)
Discussion started by: mskalyani9
3 Replies

9. Shell Programming and Scripting

Deleting Files Older than 1 hours.

How to Deleting Files Older than 1 hours. Base on SunOS. this file gen every 1 min. -rw-r--r-- 1 nobody nobody 4960 Jan 27 02:02 23_201301270201.log -rw-r--r-- 1 nobody amudu 2325 Jan 27 02:03 33_201301270202.log -rw-r--r-- 1 nobody amudu 3255 Jan 27 02:03... (2 Replies)
Discussion started by: ooilinlove
2 Replies

10. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies
sb2-show(1)							 sb2-show man page						       sb2-show(1)

NAME
sb2-show - sb2 diagnostics tool SYNOPSIS
sb2-show [-b binary_name ] [-m mode ] [-f function ] [-D ] [-v ] command [parameters] DESCRIPTION
sb2-show is a tool for querying and testing what scratchbox2 does "behind the scenes". The two most common uses are testing path mapping (commands path and which ) and finding out how programs are executed (the exec command). Additionally, there are some commands that are intended to be used internally by scratchbox2 itself, and not so useful for a normal user. sb2-show must be executed inside a scratchbox2 session (see sb2(1) for details about creating sessions) COMMANDS
Common commands: path [path1] [path2] [pathN] Show mapping results for listed pathnames which [path1] [path2].. Show mappings of pathnames, a less verbose variant of the path command (useful when using sb2-show from scripts) exec program_path [arg1] [arg2].. Show how a program would be executed, together with environment modifications. realcwd Show real current working directory (Inside a session /bin/pwd will usually report virtual paths, and this is the only way to deter- mine the real wroking directory). Commands for non-interactive use and debugging of scratchbox2: exec-cmdline file [argv1] [argv2].. show execve() modifications on a single line (does not show full details, useful when using sb2-show from scripts) log-error 'message' Add an error message to the logfile log-warning 'message' Add a warning message to the logfile verify-pathlist-mappings required-fix [ignorelist] Reads list of paths from stdin and checks that all paths will be mapped to a required prefix. This is used by sb2-check-pkg-map- pings, (an internal utility). execluafile filename Load and execute Lua code from file. binarytype realpath detect & show type of program at realpath (which is an already mapped path) var variablename show value of an internal string variable libraryinterface show preload library interface version (the Lua <-> C code interface) qemu-debug-exec file argv0 [argv1] [argv2].. show command line that can be used to start target binary under qemu gdbserver OPTIONS
-v verbose. -b binary_name show using binary_name as name of the calling program -f function show using function as callers name (full name of library or system call) -D Ignore directories while verifying path lists (effective only for the verify-pathlist-mappings command) -t report elapsed time (real time elapsed while executing the command) -x file Load and execute Lua code from file before executing the command. Useful for debugging and tuning lua scripts of sb2. -X file Load and execute Lua code from file after executing the command. Useful for debugging and tuning lua scripts of sb2. -g port use port as qemu gdbserver listening port (default port is 1234). See command qemu-debug-exec EXAMPLES
Show where the /etc directory gets mapped: $ sb2 sb2-show path /etc /etc => /opt/maemo/tools/etc (readonly) (exact results depend on how sb2-init was executed; what mapping mode is the default, etc.) Typically, home directories are not mapped: $ sb2 sb2-show path /home/yourname /home/yourname => /home/yourname In development modes, host-compatible versions of tools are executed: $ sb2 sb2-show exec /bin/ls File /bin/ls Mapped /opt/maemo/tools/bin/ls (readonly) argv[0] /bin/ls ... But in the emulation mode, only target's executables are used. Try also: $ sb2 -e sb2-show exec /bin/ls SEE ALSO
sb2(1), sb2-config(1), sb2-logz(1), sb2-init(1) AUTHOR
Lauri Aarnio 2.2 17 December 2010 sb2-show(1)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy