SharpDeveloper
Advanced File Deletion in Linux
Here is a cool way to delete files according to some complex rules without knowing complicated bash commands.
First, create a file as follows that contains your deletion rules.
+ public_html/
+ public_html/*
- access-logs
- etc/
- logs/
- mail/
- .cpanel/
- .cpaddons/
- .spamassassin/
- .ssh/
- public_ftp/
- cpmove.psql/
- tmp/
- cpeasyapache/
- MySQL-install/
Then, run rsync with the source and destination folder being the same
rsync -avz --include-from:rulesFile.txt . . --delete-excluded
You can add –dry-run if you want to see what will be deleted:
rsync -avz --include-from:rulesFile.txt . . --delete-excluded --dry-run
Related Reading:
Related Posts
Tagged with: linux
-
Articles
- January 2011
- April 2010
- March 2010
- February 2010
- January 2010
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- February 2009
- December 2008
- November 2008
- October 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
-
Meta







