Re: [SLUG] File Renaming

From: Eben King (eben1@tampabay.rr.com)
Date: Fri Aug 20 2004 - 17:38:56 EDT


On Fri, 20 Aug 2004, Levi Bard wrote:

> > for i in `find "${dir}" | grep '/[^$]'`
> > ^^^^^^^^^^^^
> >What does this do?
> >
> >
> The grep statement removes any somedir/ and somedir entries, leaving
> just somedir/otherdir/filename - to preserve directory names.

YM "grep -v". But anyhow, just say `find "${dir}" -type f` .

> >While I'm at it, you can do
> >
> > for i in `ls "${dir}" | grep '/[^$]'`
> >
> >
> Not quite, because ls only gives me one depth of the directory tree,
> where find gives me the whole thing. I considered ls -R, but find can
> be adapted to more flexible purposes later.

True. I had only considered the OP's situation, while you were looking
for flexibility. Also, find doesn't descend links (which can be good or
bad), and can be configured not to cross mount points (which is good...
the configurability, that is).

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
   Your pretended fear lest error might step in is like the man who
   would keep all wine out of the country lest men should be drunk.
                                                 -- Oliver Cromwell

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:04:43 EDT