moving everything except a directory

Michael L. Squires mikes at siralan.org
Wed Aug 31 23:21:09 GMT 2005


I use

tar cvf /<directory with a lot of space>/<my name>.tar 1 3 4 5 6 7 8 9 10
cd <new directory>
tar xvf /<directory with a lot of space>/<my name>.tar

I usually do

cd <original directory>
find . ! -type d -print > files.txt
vi files.txt - edit out files I don't want
tar cvfT /<dir with space>/<orig name>.tar files.txt
cd <new directory>
tar xvf /<dir with space>/<orig name>.tar

which lets me copy files beginning with "." in the root of the directory 
(tar will skip these in the root, copies them in subdirectories).

You also have to worry about permissions if there are executables or files 
you don't own in the directory.

There are much neater ways of doing this, but this method leaves a backup 
copy in the tar file.

Mike Squires


On Fri, 30 Sep 2005, Brian John 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?  What 
> if I wanted to move everything but directories 2 and 7?
>
> I'm not sure how to use the mv command to do this in 1 comand.
>
> Thanks
>
> /Brian
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
>


More information about the freebsd-questions mailing list