[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Locked Dirs



On Tuesday 03 December 2002 06:25 pm, Jason Lyons wrote:
> Hey there I recently downloaded a folder off an ftp that had [hxc] as the
> bwginning name of thr dir, now it says it's locked when I try to delete it
> in KDE. when I try to rm -f in a console it says it doesn't exist, I can't
> move it, delete it , or change anything about it. When I output a ls -la to
> a txt it says this about it "drwxr-xr-x    2 root     root         4096 Dec
>  2 10:18 [hXc] Falling Cycle -
> 2002 - Conflict" and when I just pull a ls -la in the console it shows up
>  with "?[hxc]? blah blah blah" the question marks, I don't get it. Could
>  someone lemme know how dumb I am I would appreciate it, as long as you
> tell me how to get rid of it to ;)  Thanks everyone.
>
>

Had this with a file a long time ago that I stupidly named with some regex 
patterns in it. Try something like this:

1> open a file, vi /tmp/delete.pl
2> Put said contents in file



#!/usr/bin/perl

my $baddir;
my $file;
my $files;
my $x;

$baddir = '/tmp/foo';

opendir(DIR, "$baddir") or die "could not open dir $baddir\n";

while ($_ = readdir(DIR)) {
        $file = "$baddir/$_";
        if ($file ne "$baddir/.") {
                if ($file ne "$baddir/..") {
                        push(@files, "$file");
                }
        }
}

closedir DIR;

for ($x = 0; $x < @files; $x++) {
        print "chowning file $files[$x]\n";
        chown(0,0,"$files[$x]") or die "could not chown file $files[$x]\n";

        print "chmoding file $files[$x]\n";
        chmod(0666, "$files[$x]") or die "could not chmod file $files[$x]\n";

        print "deleting file $files[$x]\n";
        unlink("$files[$x]") or die "could not delete file $file\n";
}

print "chowning dir $baddir\n";
chown(0,0,"$baddir") or die "could not chown dir $baddir\n";

print "chmoding dir $baddir\n";
chmod(0777, "$baddir") or die "could not chmod dir $baddir\n";

print "deleteing dir $baddir\n";
rmdir("$baddir") or die "could not delete dir $baddir\n";

print "done\n";




3> In the above, change '/tmp/foo' to the path (full path) of the dir in 
question. 
4> chmod 755 /tmp/delete.pl
5> as root run delete.pl

Hopefully you'll be in luck. Sorry for the sucky perl.

Jeremy







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]