Hi all, I've been messing around with needing to duplicate a dir tree minus its file contents. What i would like to achieve is to rsync dirs, subdirs and sym links of dirs excluding files. My first experiment was to simply do dirs and subdirs; rsync -a -f"+ */" -f"- *" source destination Worked like a champ. However I'm unsure how to include or exclude sym links from this so i tried; rsync -a -f"+ */" -f"- * -l" source destination Which breaks everything and copies all data, dirs, subdirs, sym links and files. Any ideas?
On Sun, May 16, 2010, aurfalien at gmail.com wrote:> Hi all, > > I've been messing around with needing to duplicate a dir tree minus its > file contents. > > What i would like to achieve is to rsync dirs, subdirs and sym links of > dirs excluding files. > > My first experiment was to simply do dirs and subdirs; > > rsync -a -f"+ */" -f"- *" source destination > > Worked like a champ. > > However I'm unsure how to include or exclude sym links from this so i > tried;I haven't tried this with rsync, but back in the day when we were supporting lots of SCO systems with a broken ``tar'' program, I would create a cpio archive of all non-files to allow quick recovery of the directory structure, devices, et al. I used the find command to get everything under the directory that was not a file. cd path-to-some-dir find . ! -type f | cpio ... If I could ever figure out how rsync works with lists of files or input from stdin, a similar method should work. Bill -- INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 Skype: jwccsllc (206) 855-5792 Microsoft is to computers what Phillip Morris is to lungs.
On Monday 17 May 2010, aurfalien at gmail.com wrote:> Hi all,Moin,> I've been messing around with needing to duplicate a dir tree minus > its file contents. > > What i would like to achieve is to rsync dirs, subdirs and sym links > of dirs excluding files.some time ago I wrote a shell script to clone a file system structure. It does not handle symlinks (the idea is good) and was written for solaris. If you use Linux you have to ajust the 'ls' order in the scriptpart somehow. http://www.vbox4php.org/unix/network-and-scripts/clone-directories http://www.vbox4php.org/unix/network-and-scripts/userclone Be sure that all the users and group exists at the target side. If not please use my script 'userclone' to create them http://www.vbox4php.org/unix/network-and-scripts/userclone CU> My first experiment was to simply do dirs and subdirs; > > rsync -a -f"+ */" -f"- *" source destination > > Worked like a champ. > > However I'm unsure how to include or exclude sym links from this so i > tried; > > rsync -a -f"+ */" -f"- * -l" source destination > > Which breaks everything and copies all data, dirs, subdirs, sym links > and files. > > Any ideas?-- |Michael Renner E-mail: michael.renner at gmx.de | |D-81541 Munich Germany ICQ: #112280325 | |Germany Don't drink as root! ESC:wq