[Linux-disciples] Moving files

Karl Sokol revkarl at gmail.com
Tue Jun 20 21:44:17 EDT 2006


So, I am back in town and I tried Adam's search string, but it listed only
directories with 4 letters

church at ubuntu:/share/new$ find . -iregex '^.*/[^/][^/][^/][^/]$'
./Cake
./tmbg
church at ubuntu:/share/new$ ls | tail
ZHRM.mp3
Zilla - Untitled Track 12.mp3
ZMLB.mp3
ZOYP.mp3
ZQVM.mp3
ZVWQ.wav
ZYCW.mp3
ZZAW.mp3
ZZFN.mp3
ZZ Top - Tush.mp3
church at ubuntu:/share/new$

However, to anyone who is interested, the following worked...

 find . -iregex '^.*/[^/][^/][^/][^/].mp3'

church at ubuntu:/share/new$ find . -iregex '^.*/[^/][^/][^/][^/].mp3' | tail
./QTAD.mp3
./SXIE.mp3
./WBEJ.mp3
./ZOYP.mp3
./JNVQ.mp3
./LRJF.mp3
./OSKP.mp3
./QESD.mp3
./RCRV.mp3
./TJYH.mp3

Thanks for all of your help!


On 6/6/06, Adam Rosi-Kessel <adam at rosi-kessel.org> wrote:
>
> I think the reason Steve's example didn't work is the regex is applied to
> the whole filename including path, not just the fielname. So ^....\.mp3$
> would match ./ab.mp3 but not ./abcd.mp3.
>
> This would match all filenames with four letters:
>
> find . -iregex '^.*/[^/][^/][^/][^/]$'
>
> For some reason, find doesn't seem to support
>
> '^.*/[^/]{4}$' or '^.*/[^/]\{4\}$'
>
> type syntax.
>
> Karl Sokol wrote:
> > I was a little sloppy with my English.  I meant to say that I had
> > trimmed everything from the -exec on out and it still came up with no
> > results.  The 'ls' was after much finageling and
> > /home/church/Desktop/new is still empty.
> >
> > I see the value in having this skill in the toolbox, but I have clearly
> > spent more time on it than I ought to have.  Thank you for your help
> > though.
> >
> > On 6/5/06, * Stephen R Laniel* <steve at laniels.org
> > <mailto:steve at laniels.org>> wrote:
> >
> >     On Mon, Jun 05, 2006 at 07:16:57PM -0500, Karl Sokol wrote:
> >     > church at ubuntu:/share/new$ find . -type f -iregex '^....\.mp3$'
> >     -exec mv '{}' /
> >     > home/church/Desktop/new/ ';'
> >     > church at ubuntu:/share/new$
> >     >
> >     > For that matter, removing everything from '-exec' on doesn't find
> >     anything.   I
> >     > have tried many variations, but with no success.
> >
> >     That find command, with the -exec after it, wouldn't print
> >     any output to the screen; it would just move all those files
> >     to ~church/Desktop/new .
> >
> >     If you want see which files 'find' will move without
> >     actually moving them, trim everything from -exec on. That
> >     will list the files; the -exec will move them.
> >
> >     > As for going back to itunes, something went drastically wrong and
> >     it shows that
> >     > she has no songs.  So, we mounted it as a drive and copied the
> >     songs over to my
> >     > computer.
> >
> >     It may show that she has no songs because the 'mv' command
> >     moved them. Check /home/church/Desktop/new .
> >
> >     --
> >     Stephen R. Laniel
> >     steve at laniels.org <mailto:steve at laniels.org>
> >     Cell: +(617) 308-5571
> >     http://laniels.org/
> >     PGP key: http://laniels.org/slaniel.key
> >
> >
> >     -----BEGIN PGP SIGNATURE-----
> >     Version: GnuPG v1.4.2.2 (GNU/Linux)
> >
> >     iD8DBQFEhNVTHa1lzVGot+YRAoc3AJ9qtIOoFEv3VDp8cMmsbTGV7PIgfwCfTvMa
> >     ULyaKddzxoXxjRHLtCRmJ44=
> >     =Yk1h
> >     -----END PGP SIGNATURE-----
> >
> >
> >     _______________________________________________
> >     Linux-disciples mailing list
> >     Linux-disciples at lists.bostoncoop.net
> >     <mailto:Linux-disciples at lists.bostoncoop.net>
> >     http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
> >
> >
> >
> >
> >
> > --
> > Grace and Peace,
> >
> > Rev. Karl Sokol
> > Franklin Grove UMC
> > 223 N. Middle St.
> > Franklin Grove, IL 61031
> >
> > *happiness is when
> > what you think,
> > what you say,
> > and what you do
> > are in harmony.*
> > -GANDHI-
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Linux-disciples mailing list
> > Linux-disciples at lists.bostoncoop.net
> > http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>



-- 
Grace and Peace,

Rev. Karl Sokol
Franklin Grove UMC
223 N. Middle St.
Franklin Grove, IL 61031

*happiness is when
what you think,
what you say,
and what you do
are in harmony.*
-GANDHI-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060620/5b9f5cb3/attachment.html


More information about the Linux-disciples mailing list