The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Shell Noob
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-30-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,770
You are kinda vague. If you need to move a whole tree try something like this:
Code:
cd /path/to/upper/level/of/source
tar -cvf - $(find . -print -type f) | (cd ../destination ; tar -xvf -)
find gets all of the files in the source tree, feeds the file to tar, the tar on the other end of the pipe then parks the file in a new directory tree with the same subdirectories. This is not deleting anything. This is a VERY general solution -