[conspire] (forw) Re: UNIX beginner asks: what's a good forum for q's about command-line utilities?

Tony Godshall tony at of.net
Fri Sep 3 16:09:16 PDT 2010


Michael Gray:

>> I want to move multiple files to a directory. I know how to use mv to do
>> this one file at a time (i.e., mv [file] [directory]), and I figure there
>> must be a way to do it en masse, without naming each file explicitly. Below
>> is my conversation with the system. On the off chance that mv supported
>> perl-like regular expressions, I tried using .* as a wildcard, but mv does
>> not like that. ("August, 2010" is a directory; anything named "August x,
>> 2010", where x is a numeral, is a file. I have deleted the full pathname for
>> privacy and inserted a few hard carriage returns for readability.)

It appears your main issue is confusion about shell wildcards (or
globbing) vs. regular expressions.  But I gather you've figured that
out by now.  And that you've found that conspire list is quite happy
to give you lots of answers.

I do concur with some that it is easier to not have spaces n stuff but
realistically filenames are not always created by ourselves, so
backslashes, quotations and, most reliably, the null-delim tools like
find -print0 and xargs -0 and [fe]grep's -Zz do the job quite well.

One additional tip I might note: when your target is a directory it
can save mistakes like copy-many-to-same-and-overwrite to add an
explicit /. to the end- for many of us it just becomes a habit.



Deirdre Saoirse Moen:

> If you want to  move ALL the files (and only those that have changed, which will initially be all of them):
>
> rsync -av src dest
>
> e.g., rsync -av ./ ~/Sites/deirdre.net/

Sorry if this is too picky, but rsync *copies* files.  The OP wanted
to *move* files.


Best Regards.




More information about the conspire mailing list