LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-02-2007, 06:59 AM   #1
hitesh.sharma84
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Rep: Reputation: 0
delete oldest file in dir. by c program


hello friends ,
actually i want to delete the oldest file in the dir.(the path of dir. will be given by command line) by using c program .
i am able to entering in the direstory and print the all file of directory , but next step , i am unable to do it.
plz help me ..................
thanks a lot ..........
 
Old 05-02-2007, 10:18 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hya,
Code:
#include <stdio.h>

int main(void){
remove(/path/to/file/to/be/deleted);
}
Happy Penguins!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't delete a dir!?!?! Even as root??? yanik Linux - Software 9 07-05-2007 01:41 AM
I Can't Delete a DIR carlosinfl Linux - General 2 10-19-2005 07:44 AM
Auto Delete oldest files @ratex when directory is 98% full jmanjohn61 Linux - Software 1 04-05-2005 03:44 PM
How to delete a dir and all it's content? ReSync Linux - Newbie 2 06-29-2002 06:45 AM
Delete a dir from prompt bkeating Linux - General 11 05-23-2002 05:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration