Re: Please advice
by kennethk (Abbot) on Aug 10, 2011 at 13:32 UTC
|
This is not a code writing service - monks are generally very generous with their assistance, but we are here to assist you, not to do your work. Show us what you've tried, what didn't work, what you thought might work, etc.
Also, please wrap input and output in <code> tags just like you would code - it will preserve white space formatting and prevent a couple of perlmonks shortcuts from kicking in.
With regards to some of the specific questions you do ask, I would recommend checking out DateTime and File::Find.
| [reply] [d/l] |
Re: Please advice
by toolic (Bishop) on Aug 10, 2011 at 13:21 UTC
|
I need a program i.e. code of perl script for the following requirement
If you are interested in learning Perl, see the free documentation, perlintro, then open your favorite editor, and start typing some legal Perl syntax.
| [reply] |
Re: Please advice
by thenaz (Beadle) on Aug 10, 2011 at 13:25 UTC
|
You can get the arguments passed into your script via $ARGV[#] (e.g. $first = $ARGV[0];). Then use opendir() and readdir() to find all the files in each of the subdirectories. After that, it's just loops and print statements.
| [reply] [d/l] [select] |
|
#!/usr/bin/perl
use strict;
use warnings;
use POSIX ();
print ("Enter the directory name and date as input arguments:");
chomp($which_directory=@ARGV[0]);
chomp($which_date=@ARGV[1]);
die("Nothing entered as directory path name\n" if ($which_directory eq
+ "");
die("Nothing enetered as update date\n" if ($which_date eq "");
opendir(DIR,$which_directory);
my @dir = grep { !/^\.+$/ } readdir(DIR);
foreach (@dir)
{
-->Here I need to get all sub directories and then do a cd in each
+ diectory
}
| [reply] [d/l] |
|
@ARGV is the array of command line arguments (see perlvar .. and they would not normally need to be chomped). If you want to prompt the user for arguments, you can use:
print "Enter directory: ";
chomp(my $dir = <STDIN>);
Or you might try IO::Prompt. For searching subdirectories, you can use File::Find. You are automatically chdir'd to the directory of each file as it is 'found'. | [reply] [d/l] |
|
| [reply] |
|
No need to chomp @ARGV, these are command-line arguments, they are not read from a file. To find if a file is a directory, you can use -d To find the date/time stamps on a file, use stat
| [reply] [d/l] [select] |
|
|
Re: Please advice
by Anonymous Monk on Aug 10, 2011 at 13:20 UTC
|
- The first thing you need to do is open a text editor.
- Next, type in use strict; use warnings;
- Then write your perl script in there.
Alternatively, you can fix the formatting of this post and then post it on jobs.perl.org, but be sure to include how much your are willing to pay.
| [reply] [d/l] |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Re: Please advice
by perl.j (Pilgrim) on Aug 10, 2011 at 21:31 UTC
|
Well, if you are asking us to make the code, your probably out of luck.
| [reply] |
|
Monks, It is not my endeavour to get the code written from you. Definitely I need help. I beleive all of you will help me out!
Kindly help me as of now for how to look for sub directories under a sub directory and then taking the time stamp of all files under that sub directory and then matching the timestamp
Please guide me here!
| [reply] |
|
| [reply] |
|
|
|
|