Results 1 to 3 of 3
Hi there,
I wonder how to delete exactly 90 per cent of the files RANDOMLY in a given directory.
The lines below show how to delete appoximately 90 per cent ...
- 05-21-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 2
Delete Exactly 90 Per Cent of the Files in a Directory
Hi there,
I wonder how to delete exactly 90 per cent of the files RANDOMLY in a given directory.
The lines below show how to delete appoximately 90 per cent of the files given as arguments. But what I need is an exact solution.
Any sript is welcome! And please, do not ask why! This is no joke.Code:#!/bin/bash while [ $# -gt 0 ] do if [ 0 -ne $[ ( $RANDOM % 10 )] ] then rm $1 fi shift done
Last edited by whydoihavetoregister; 05-21-2008 at 03:44 PM. Reason: missing but important word added
- 05-21-2008 #2
HIdden files also, or not?
And do we include . and .. in the count of files?--
Bill
Old age and treachery will overcome youth and skill.
- 05-21-2008 #3Just Joined!
- Join Date
- May 2008
- Posts
- 2


Reply With Quote
