Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Oct 2005
    Posts
    4

    -execdir option


    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 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.
    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.
    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.

  2. #12
    Just 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]");
    }

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •