cmd find: exclude directory when using option -depth
hello,
i want to use "-depth" in command "find" and want to exclude a directory.
the find command should work in HP-UX and Linux.
so my tests , in the example in want to exclude directory "excludedir", only the example with "-path" works , is there another option to use "-prune" and "-depth" ?
OK
OK
NOTOK
NOTOK , syntax error in Linux:
find: warning: you have specified the -depth option after a non-option argument !,
but options are not positional (-depth affects tests specified before it as well as those
specified after it). Please specify options before other arguments.
How can i tweak the below find command to exclude directory/s -> "/tmp/logs"
find . -type f \( ! -name "*.log*" ! -name "*.jar*" \) -printNote: -path option/argument does not work with the version of find that i have.
bash-3.2$ uname -a
SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v (7 Replies)
Hi All,
Can you please help me in understanding the importance of -depth of find.
I am trying to execute below code.find . -mtime +5 -name "*" -depth -exec ls -l {} \;
But it is throwing below error.find: warning: you have specified the -depth option after a non-option argument -mtime,... (2 Replies)
I am familiar with using tar and exclude/include files:
tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion
but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Hi All,
First my OS version is:
ksh:0$ uname -a
SunOS 5.9 Generic_122300-48 sun4u sparc SUNW,Sun-Fire-V440
I want to exclude the following DIR(./country111) in my search pattern:
ksh:0$ find . -name "*.tar"
./country111/COUNTRY_BATCH-801.tar
./country111/COUNTRY_BATCH-802.tar... (3 Replies)
Hi,
I'm in the process of writing a shell script which will be ran under cron hourly and will check for files of specific age in my ftp folder, then moves those over inside a folder called "old" (which is within the ftp dir). But, I'm unable to figure out how to exclude the "old" folder when... (1 Reply)
Hi all,
In a directory, I have many video files. Example :
As you can see, some of the video files come with a .aspx file (wich
means the video is actually being uploaded and not entirely written on
the FS)
I try to write a bash script that would find all video files in the
... (1 Reply)
Hi Frdz,
i am using rsync to transfer files from source to destination. but i have one criteria like i have to tranfer only links from source to destination.
in home/test/po folder i have
kiran/test1 -> /home/test/lo/fg
kiran/test2 -> /home/test/lo/fg2
like links are available.... (1 Reply)
I'm using bash on cygwin/windows.
I'm trying to use find and exclude the directory /cygdrive/c/System\ Volume\ Information. When I try to use the command below I get the error "rm: cannot remove `/cygdrive/c/System Volume Information': Is a directory.
Can someone tell me what I am doing... (3 Replies)
Dear All , :D
I have a question ... I need to exclude the absolute path in the TAR process.
For example :
system("tar cvf /root/BACKUPS_$fecha.tar /root/BKP/");
system("gzip /root/BACKUPS_$fecha.tar");
I need to exclude de path " /root/BKP/ " in the file.tar.gz
What is the parameter to... (1 Reply)
i want to compile a list of files in all sub directories but exclude the current directory.
the closest i could get was to search 'only' the current directory, which is the opposite of what i wanted.
find . ! -name . -prune (7 Replies)