Sponsored Content
Full Discussion: Problem with `find ...`
Top Forums Shell Programming and Scripting Problem with `find ...` Post 80580 by Cameron on Tuesday 9th of August 2005 11:55:31 PM
Old 08-10-2005
Question Problem with `find ...`

Hi all,
Have the following snippet of code that I'm having trouble trying to work ...

The snippet of code is running on our Production Server and the intent is to copy the second most recent IDE file across from the Development Server.

I have the following files defined in $DEVLOC ...
Code:
-rw-r--r--   1 root       sys         245751 Aug  1 09:23 050729.14:20.ides.zip
-rw-r--r--   1 root       sys         245751 Aug  1 09:23 050729.14:32.ides.zip
-rw-r--r--   1 root       sys         245751 Aug  1 09:23 050729.15:18.ides.zip
-rw-r--r--   1 root       sys         245751 Aug  1 09:23 050729.15:28.ides.zip
-rw-r--r--   1 root       sys         247925 Aug  1 09:23 050730.00:05.ides.zip
-rw-r--r--   1 root       sys         249305 Aug  1 09:23 050731.00:05.ides.zip
-rw-r--r--   1 root       sys         253966 Aug  1 09:23 050801.00:06.ides.zip
-rw-r--r--   1 root       sys         121667 Aug  1 23:18 050802.00:05.ides.zip
-rw-r--r--   1 root       sys         128756 Aug  2 19:31 050803.00:05.ides.zip
-rw-r--r--   1 root       sys         131843 Aug  3 19:27 050804.00:05.ides.zip
-rw-r--r--   1 root       sys         137142 Aug  4 13:44 050805.00:05.ides.zip
-rw-r--r--   1 root       sys         143807 Aug  5 19:33 050806.00:05.ides.zip
-rw-r--r--   1 root       sys         146817 Aug  6 21:22 050807.00:05.ides.zip
-rw-r--r--   1 root       sys         146817 Aug  6 21:22 050808.00:05.ides.zip
-rw-r--r--   1 root       sys         150047 Aug  8 23:34 050809.00:05.ides.zip
-rw-r--r--   1 root       sys         155809 Aug  9 23:17 050810.00:05.ides.zip

I'm tried (in vain) initially to assign the most recent file, but business now requires second most recent (for QA reasoning).

I'm sure that I'm missing something really simple; just need a kick in the pants to have someone point it out for me; not having used `find` in scripts prior.
Code:
IDEtoFind=`find $DEVLOC -name \*.ides.zip -mtime -01 -print`
echo "Finding : $DEVLOC/$IDEtoFind" >>$templog
echo "Finding : $DEVLOC/$IDEtoFind"
echo "Copying : $DEVLOC/$IDEtoFind" >>$templog
echo "     To : $tmp/$downloadfile" >>$templog
echo "Copying : $DEVLOC/$IDEtoFind"
echo "     To : $tmp/$downloadfile"
cp $DEVLOC/$IDEtoFind $tmp/$downloadfile || error_copy

Any pointers would be of great assistance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another Find Problem

HI All, I am having a bit of trouble using the find command in my shell (korn) script. I was hoping someone could help me. I am trying to build up a dynamic find command based on some parameters. When I execute the command I get the following error: find: incomplete statement I have... (6 Replies)
Discussion started by: sethkor
6 Replies

2. Shell Programming and Scripting

problem with find

Hi, Iam having a strange problem, wandering if soneone can throw some lights. I have statement find . -maxdepth 1 -name 'File1*.tsv' -mtime +1 -print I expect the above statement to print the files older than 1 day or 24 hrs, however it doesn't work that way. When issue above command,... (2 Replies)
Discussion started by: braindrain
2 Replies

3. UNIX for Dummies Questions & Answers

Problem with find and tar

When I am doing the first command the result shows all the files, links, directories except the ones that contain the word logs find . -type f -o -type l -o -type d | grep -v logs But when I am trying to do this even the logs are getting tarred tar -cvf fdtvision.tar `find . -type f -o -type l... (2 Replies)
Discussion started by: venu_nbk
2 Replies

4. UNIX for Dummies Questions & Answers

problem with find and mtime

I am using HP-UNIX , The below command doesnt display anything although i have changed a file in the directory by toutch -t 200010101800 nfile find /tmp/transfer/ -name "*.*" -mtime +1 Any problrm with the find command i written . .Please help ??.. Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

5. Shell Programming and Scripting

Find command problem

Hi All, I am using following find command to delete the records older than 7 days but getting missing conjuction error.Kindly suggest: The command is: find <complete_dir_path> \(! -name usr -prune \) -type f -name "*.txt" -mtime +6 -print | xargs rm (11 Replies)
Discussion started by: visingha
11 Replies

6. Shell Programming and Scripting

Problem with find command.

I'm trying to display the full file name (including the full path) and file size of all files whose name (excluding the path) is longer than 10 characters. I came up with find path -type f -name ".{10, }" -printf "%s %p\n", but I'm getting a "find: path: No such file or directory". What's wrong... (2 Replies)
Discussion started by: raidkridley
2 Replies

7. Shell Programming and Scripting

find problem

for index in `find /root -name *.jar | grep "/lib"`; do echo "$index"; done sometimes its throwing error saying find: paths must precede expression Usage: find some1 suggested me that : Code: for index in `find /technologies -name '*.jar' | grep "/lib"` do echo "$index"... (2 Replies)
Discussion started by: crackthehit007
2 Replies

8. Shell Programming and Scripting

find problem

Hi I want to find files with size +10000M and specified directorys except when i use more than one `-name` acton is fail I try -a (and) and -o (-or) but results fail :( find . \( -name ./oracle* -prune -o -name "*arc*" -prune -o -name "*oracle*" -prune -o -size +10000k \) -exec ls -lh {}... (7 Replies)
Discussion started by: ygemici
7 Replies

9. Shell Programming and Scripting

Problem with find command "find: cannot open"

Hello Guys , I am trying to run below find command in one of my SH script on a HP UX machine. find /tmp -type f -name "MGCA*.log" -prune -exec rm -f {} \; 2>&1 I want this to check my tmp directory and delete MGCA log files .But below error message is printed on Promt :- find: cannot... (2 Replies)
Discussion started by: himanshu sood
2 Replies

10. Shell Programming and Scripting

Problem with find

Hello, I have trouble using the find command (I am working on Mac OSX). for i in *.pdf do if find . -name "EV" then mv "$i" E-test.pdf elif find . -name "GV" then mv "$i" G-test.pdf else mv "$i" test.pdf fi done As to the use of "$i": unfortunately, the filenames... (14 Replies)
Discussion started by: tempestas
14 Replies
ZIP_SET_ARCHIVE_COMMENT(3)				     Library Functions Manual					ZIP_SET_ARCHIVE_COMMENT(3)

NAME
zip_set_archive_comment - set zip archive comment LIBRARY
libzip (-lzip) SYNOPSIS
#include <zip.h> int zip_set_archive_comment(struct zip *archive); "const char *comment" "int len" DESCRIPTION
The zip_set_archive_comment function sets the comment for the entire zip archive. If comment is NULL and len is 0, the archive comment will be removed. RETURN VALUES
Upon successful completion 0 is returned. Otherwise, -1 is returned and the error information in archive is set to indicate the error. ERRORS
zip_set_archive_comment fails if: [ZIP_ER_INVAL] len is less than 0 or longer than the maximum comment length in a zip file (65535). [ZIP_ER_MEMORY] Required memory could not be allocated. SEE ALSO
libzip(3), zip_get_archive_comment(3), zip_get_file_comment(3), zip_set_file_comment(3) AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at> NiH October 26, 2007 ZIP_SET_ARCHIVE_COMMENT(3)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy