Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write a program to display all the files from the current
directory which are created in particular month

Answers were Sorted based on User's Feedback



write a program to display all the files from the current directory which are created in particula..

Answer / rakesh

#include<stdio.h>

#include<stddef.h>

#include<dirent.h>

#include<string.h>

#include<sys/types.h>

#include<sys/stat.h>

#include<time.h>

#include<stdlib.h>


int main(int argc,char *argv[])

{

char in[100],st[100],*ch,*ch1,c,buff[512];

DIR *dp;

int i;

struct dirent *ep;

struct stat sb;

char mon[100];

dp=opendir("./");

if(dp!=NULL)

{

while(ep=readdir(dp))

{

if(stat(ep->d_name,&sb)==-1)

{

perror("stat");


exit(EXIT_SUCCESS);

}

strcpy(mon,ctime(&sb.st_ctime));

ch=strtok(mon," ");

ch=strtok(NULL,",");

ch1=strtok(ch," ");


if((strcmp(ch1,argv[1]))==0)

{

printf("%s \t\t %s",ep->d_name,ctime(&sb.st_ctime));

}

}

(void)closedir(dp);

}
return 0;

}

Is This Answer Correct ?    3 Yes 0 No

write a program to display all the files from the current directory which are created in particula..

Answer / geichel

Create time is not kept in the inode. Times for Access,
Modify, and Change is all you get.

Is This Answer Correct ?    1 Yes 1 No

write a program to display all the files from the current directory which are created in particula..

Answer / pitambar mishra

Mr. Rakesh,
It is a unix forum. You have written the program in C language. Please convert the program in to shell script.

Ans:
ls -l|grep -i sep
ls -l|awk '/Sep/ {print}'
ls -l|sed -n '/Sep/ p'

Is This Answer Correct ?    0 Yes 0 No

write a program to display all the files from the current directory which are created in particula..

Answer / kiran penujuri

ls -ltr * | grep Month Name

Is This Answer Correct ?    2 Yes 3 No

write a program to display all the files from the current directory which are created in particula..

Answer / dejan

This is a tricky question. You are able to see only

Access: 2010-12-08 09:36:52.000000000 +0100
Modify: 2010-12-07 13:20:16.000000000 +0100
Change: 2010-12-07 13:20:16.000000000 +0100

There is no "create field"

Is This Answer Correct ?    1 Yes 2 No

write a program to display all the files from the current directory which are created in particula..

Answer / sathish kumar p

echo "Enter the month name"
read Month
ls -lt | grep $Month

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Shell Script Interview Questions

Can we run shell script in windows?

0 Answers  


how to delete all the files with extension .dat rom a directory tree from root to third level in a single unix command?

4 Answers  


What is the difference between break and continue commands?

0 Answers  


Why is used in shell scripting?

0 Answers  


write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument is more or less than one,print a usage message c) if the argument is not adirectory, print another message d) for the given directory, print the five biggest files and the five files that were most recently modified. e) save the output to a file called q2output.

2 Answers  


How will you schedule a job that will run every month last day?(some months have 30 days,some 31 days,28,29 days)

1 Answers   NTT Data, TCS,


why did you apply to shell

3 Answers   Shell,


What is web script?

0 Answers  


How to debug the problems encountered in the shell script/program?

0 Answers  


What does $# stand for?

3 Answers   IBM,


write a program to display all the files from the current directory which are created in particular month

6 Answers  


What is bash command used for?

0 Answers  


Categories