This prevents errors if there happens to be subdirectories
find /var/lib/ldap/* -mindepth 1 -maxdepth 1 -exec mv \{\} /var/backups/<ldap-backup-dir> \;
Notice the maxdepth (in addition to mindepth). Otherwise things that have already been moved are referenced causing find to barf (if there are subdirs).
I have attached a test script - it will create a directory test-move and some test dirs/files therein. It then uses the test data to see if the above works.
Cheers -- Adam Clarke Strategic Data Pty Ltd www.strategicdata.com.au [EMAIL PROTECTED] [p] +61-3-9348-2013 [f] +61-3-9348-2015
echo "Make some files to test on" echo " d - has test files" echo " d.backup - is empty"
mkdir test-move cd test-move mkdir d mkdir d.backup mkdir d/d-recursive mkdir d/.d-recursive touch d/nothidden touch d/.hidden touch d/..hidden cp d/{.,}*hidden d/d-recursive/ cp d/{.,}*hidden d/.d-recursive/ echo "Look in d - should have files" ls -alR d echo "Look in d.backup - should be empty" ls -alR d.backup echo "Now move stuff" find d -mindepth 1 -maxdepth 1 -exec mv \{\} d.backup \; echo "Now d is empty" ls -alR d echo "Now d.backup has files" ls -alR d.backup