--- Brian John <[EMAIL PROTECTED]> wrote:

> Say I am at ~ and I have 10 directories inside named
> 1, 2, 3, 4 ,5, 6, 
> 7, 8, 9 and 10.  What command can I use to move
> everything but directory 
> 2?  
You can use combination of different commands to solve
this problem.

Base on your problem, you can move all directories
excetp 2.
mv `ls -l | grep -v 2 | awk -F " " '{print $9}'` 
<destination directory>

Take note that the above commands do not only move the
directories and its contents but also all the files in
the current directory. If this is what you want, then
the above commands will do it.

What if I wanted to move everything but
> directories 2 and 7?

Just pipe another command,e.g. "grep -v 7", after the
first grep command.

Another option is to write a script if you want 
> 
> I'm not sure how to use the mv command to do this in
> 1 comand.
> 
> Thanks
> 
> /Brian
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
>
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "[EMAIL PROTECTED]"
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to