[Linux-disciples] Moving files

Adam Rosi-Kessel adam at rosi-kessel.org
Tue Jun 6 12:05:17 EDT 2006


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



More information about the Linux-disciples mailing list