find/xargs question...
Kurt Wall
kwall at kurtwerks.com
Thu Dec 28 08:04:18 UTC 2006
On Wed, Dec 27, 2006 at 11:40:44PM -0800, bruce wrote:
> hi...
>
> i have what i think is a combination find/xargs question....
>
> i'm trying to search through a dir tree for files matching certain patterns
> and i want to rename the files. i'd also like to ignore certain dirs.
>
> ie...
>
> [root at lserver2 wctest]# ls -al
> total 24
> drwxr-xr-x 5 root root 4096 Dec 27 21:46 .
> drwxr-xr-x 48 root root 4096 Dec 27 21:45 ..
> drwxr-xr-x 3 root root 4096 Dec 27 21:46 class
> drwxr-xr-x 3 root root 4096 Dec 27 21:46 faculty
> drwxr-xr-x 7 root root 4096 Dec 27 21:46 .svn
>
> ./class:
> total 20
> drwxr-xr-x 3 root root 4096 Dec 27 21:46 .
> drwxr-xr-x 5 root root 4096 Dec 27 21:46 ..
> -rw-r--r-- 1 root root 248 Dec 27 21:46 childClass.py
> drwxr-xr-x 7 root root 4096 Dec 27 21:46 .svn
> -rw-r--r-- 1 root root 239 Dec 27 21:46 zu_fl_2772Class.py <<<<<
>
> i'd like to find any file with "zu_fl*Class" and replace it with
> zu..ClassFFFF. so basically, i'm finding any given file with a pattern
> followed by Class, and adding FFFF to it along with the file extension.
>
> i'd also like to ignore specific dirs as well... in this case, i'd like to
> ignore the ".svn" folder...
>
> this should be pretty esay, but i can't seem to get the nuances down.
>
> any thoughts/preferrably pointers as to how to perform this action..
Untested:
find /some/dir -name zu_fl\*Class -a ! -name \*\.svn\*
Find everything in or under /some/dir whose name matches the pattern
zu_fl*Class and whose name does not contain the pattern *.svn.
Kurt
--
A tautology is a thing which is tautological.
More information about the fedora-list
mailing list