-type d`
> do
> touch $dir/-i
> done
The only problems I can find with this little trick are 1) that your rm -rf commands will fall flat on their faces if you also have files named -a or -d (or any file names starting with a hyphen) because these file names will be interpreted as invalid options to the rm command, causing it to fail and 2) because the rm -rf command will ignore your -i file completely and remove your files without a second thought if you also have files beginning with some other oddball characters like $ (any characters that precede the hyphen in the ASCII character set and are allowable in file names) because files with names like $file will move your -i file further to the right in the resultant command, disrupting its interpretation as a command option.
- ‹ previous
- 1
- 2



















