[vox-tech] Removing Files

Daniel Hurt vox-tech@lists.lugod.org
Thu, 20 May 2004 12:21:42 -0700


Tim Riley wrote:
> 
> Try writing a C program to remove these using the unlink() system
> call.
> 

I tried writing a C program to solve the problem and no luck.  Here is a 
  link to a bzipped copy of the file if you are interested in looking at it:

http://www.mcising.net/files/test.c.bz2

The program takes the current working directory and then prints the 
contents out.  Then it tries to match any file starting with the 
character "E" and unlinks that file ( *** BE CAREFUL if you run it, it 
will unlink all files in the current directory that match that criteria 
without asking!!! ). The results of running the program are ( no 
different if run as root ):

[/usr/media/movies] # ./a.out
.
..
Evil Dead 3 - Army of Darkness (Director´s Cut).avi
Found the File!
Full Filename:
    /usr/media/movies/Evil Dead 3 - Army of Darkness (Director´s Cut).avi
Could not delete file
Error: No such file or directory
a.out
test.c.bz2

Dan