09-02-2012
Quote:
That pattern it's a directory tree path rooted at each given file name , so it's not necessarily a directory inside which find will begin its searches.
Notice that post #3's
-exec ls ... output contains duplicate filenames. There is nothing in that find command that prints a matching file name twice (and non-consecutively), and since a directory cannot contain two identically-named files, the shell
must be matching one or more directories with that pattern (in addition to *test* files in tmp, if any).
With a directory path, the
-exec predicates of those find commands will list or attempt to delete every regular file in that directory and its subdirectories, regardless of a file's name.
Quote:
It should != it must.
True, but it's preferable to be precise and avoid this type of unnecessary bug.
Regards,
Alister
Last edited by alister; 09-02-2012 at 03:24 PM..
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
i am writing a shell script in korn shell
which deletes all the files in a directory
once in every 10DAYS.
the directory has different format files.
the script has something like this;
cd /home/data/pavi
echo "Please Enter the Number of Days to search for"
read DAYS... (2 Replies)
Discussion started by: pavan_test
2 Replies
2. UNIX for Advanced & Expert Users
Hi,
I'm using the following command to get a list of files on the system.
find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \;
however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work... (1 Reply)
Discussion started by: Sebarry
1 Replies
3. Shell Programming and Scripting
Hi People,
I have a directory full of compressed files (.Z extention)
In many of these files there is a string pattern (3800078163033)
I want to find all file names which contain this string in their text.
Regards,
Abhishek (2 Replies)
Discussion started by: max29583
2 Replies
4. Shell Programming and Scripting
Hi
I have a little problem with the find command in a script that I'm writing. The script should check if there are some files younger than 100 seconds and then syncronise them with rsync.
My find command:
find -type f -cmin -100 -exec rsync -a --delete directory1/ directory2/
When I... (8 Replies)
Discussion started by: oku
8 Replies
5. Shell Programming and Scripting
Hello All,
Is there a way to make exec do a couple of operations on a single input from find?
For example,
find . -type d -exec ls -l "{}" ";"
I would like to give the result of each "ls -l" in the above to a wc. Is that possible?
I want to ls -l | wc -l inside exec. How do I... (1 Reply)
Discussion started by: prasanna1157
1 Replies
6. Shell Programming and Scripting
Hi all,
Please could someone help with the following command requirement.
I basically need to find files NEWER than a given file and order the result on time.
My attempt so far is as follows:
find . -newer <file_name> -exec ls -lrt {} ;\
But I dont seem to get the right result... (12 Replies)
Discussion started by: jonnyd
12 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have two scripts that remove files. One works fine and is coded
find -name "syst*" -mtime +1 -exec rm {} \;
The other is almost the same - only thing missing is the '\'. On that script though I keep getting:
rm syst1202.file ?
etc
Does the \ make that difference or is it a... (3 Replies)
Discussion started by: Grueben
3 Replies
8. Shell Programming and Scripting
Hi all,
I am trying to find files newer than a given file and them mv them to a new location.
So I far I have:
find . ! -newer <file_name> -exec ls -l {} \;
and
find . ! -newer <file_name> -exec mv /TEMP_LOCATION {} \;
find is not liking this.
Anyone know how to modify the last... (2 Replies)
Discussion started by: jonnyd
2 Replies
9. Shell Programming and Scripting
Hello.
From a script, a command for a test is use :
find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc'
Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies
LEARN ABOUT DEBIAN
dh-exec-install
DH-EXEC-INSTALL(1) dh-exec DH-EXEC-INSTALL(1)
NAME
dh-exec-install - Install (and possibly rename) files.
SYNOPSIS
#! /usr/bin/dh-exec
debian/default.conf => /etc/my-package/start.conf
usr/bin/*
DESCRIPTION
Being a sub-command of dh-exec(1), this program must not be ran directly, but through dh-exec, which automatically runs all available
sub-commands if run bare; or explicitly with dh-exec --with=install.
It is meant to be used for dh_install(1) files, and those alone. If it finds that its input is not such a file, it will do nothing, but
echo back the contents.
The purpose of the program is to extend dh_install(1)'s functionality, by allowing to specify a destination filename.
This can be accomplished by a special syntax: the " => " mark between a source and a destination means that the source file should be
installed with the specified destination name.
For obvious reasons, the source must not be a wildcard, and the destination in this case must be a file, and not a directory.
All other non-comment lines are left alone.
RESTRICTIONS
Due to the way executable scripts are called from debhelper(1), there is no way to know what options were used for the original
dh_install(1). This means, that the --sourcedir option of dh_install(1) will not work correctly when dh-exec-install is in use.
IMPLEMENTATION
Internally, the renaming happens by creating a temporary directory under debian/tmp/, and copying (or moving, if the source was under
debian/tmp/ to begin with) the file there, with the new name.
This is done this way to allow dh_install(1) to do the real copying, and allow its options to continue working, even when renaming is
involved.
The temporary directory is put under debian/tmp so that it will be cleaned by dh_prep(1) when the clean target gets to run. Thus, no extra
code is needed anywhere to clean up the renamed files.
ENVIRONMENT
DH_EXEC_SCRIPTDIR
Indicates which directory the command-specific scripts should be sought for. If not specified, scripts will be searched for in
/usr/share/dh-exec/.
FILES
$DH_EXEC_SCRIPTDIR/dh-exec-install-*
The various scripts for the higher-level program.
SEE ALSO
debhelper(1), dh-exec(1), dh_install(1)
AUTHOR
dh-exec-install is copyright (C) 2011-2012 by Gergely Nagy <algernon@madhouse-project.org>.
2012-05-03 DH-EXEC-INSTALL(1)