Results 11 to 12 of 12
From the man page for find:
-execdir command {} +
Like -exec, but the specified command is run from the subdirec-
tory containing the matched file, which is not normally ...
- 10-21-2005 #11Just Joined!
- Join Date
- Oct 2005
- Posts
- 4
-execdir option
From the man page for find:
A more complete discussion of the security considerations around -exec can be found in the info file for findutils - File: find.info, Node: Race Conditions with -exec.-execdir command {} +
Like -exec, but the specified command is run from the subdirec-
tory containing the matched file, which is not normally the
directory in which you started find. This a much more secure
method for invoking commands, as it avoids race conditions dur-
ing resolution of the paths to the matched files.
The security considerations here relate to race conditions, and file systems changing as they are being processed by find. In a single user system, where none of the files are being accessed simultaneously by other users, you are at a lower risk of exposure to these race conditions. In such cases, -exec 'should' be safe for your purposes.
- 07-23-2010 #12Just Joined!
- Join Date
- Jul 2010
- Posts
- 1
recursive shred
Here's a quick perl script that can do recursive shred,
name the file shredR.pl
"copy code"
open a terminal
"vi shredR.pl"
"i"
"shift insert" paste
"exc"
":wq"
"chmod 700 shredR.pl"
run it in the super directory of the directory you wish to shred, or give the full path to the directory you wish to shred.
./shredR.pl [directory name] [number of times you wish to write over the files]
Code:#!/usr/bin/perl @lines = `ls -Rt1A $ARGV[0]`; $size = scalar(@files); $i = 0; $line = ""; @cut = ""; @cut2 = ""; @cut3 = ""; $size3 = 0; $size4 = 0; $directory = ""; foreach $line (@lines) { chomp($line); if($line =~ m/\//) { @cut = split(':', $line); $cut[0] =~ s/ /*/g; $directory = $cut[0]; } elsif($line ne "" || $line ne " " || $line ne "\n") { $line =~ s/ /*/g; system("shred -fvuz -n $ARGV[1] $directory/$line"); } system("rm -fr $ARGV[0]"); }



