Tricky Deleting

Nicholas Leippe nick at byu.edu
Tue Mar 8 17:21:16 MST 2005


On Tuesday 08 March 2005 05:16 pm, Eric Jensen wrote:
> Working with a new backup scheme and trying to think of a good way to
> delete all sub folders of a directory, but not any files in the root of
> the directory.  For example, I have a directory structure like:
> /2005/03/08.  Folder '03' has a folder for every single day with the
> daily backups.  At the end of the month I am moving the last day's
> backups to the root of the month's folder (03) and then want to clear
> out all the daily folders.  I could just copy them to a temporary
> folder, do the traditional rm -rf and move the files back.  But curious
> to know if there is a handier way to do this, since I'm sure it will
> come up again.

find /2005/03/ -maxdepth 1 -type d | xargs rm -rf

-- 
Respectfully,

Nicholas Leippe
Sales Team Automation, LLC
1335 West 1650 North, Suite C
Springville, UT  84663 +1 801.853.4090
http://www.salesteamautomation.com



More information about the PLUG mailing list