
allensim81
New User
Jul 23, 2009, 2:24 AM
Post #1 of 3
(260 views)
|
|
Create new folder with the current month as the folder name
|
Can't Post
|
|
HI, I am newbie in Perl. Can anyone guide me how to create a folder with the current month as the folder name? What variable should i declare? Following is my code: #!/usr/bin/perl $websites="/data/websites"; opendir(DIR, $websites); @files=readdir(DIR); closedir(DIR); for $file(@files) { ## List all files and directories from /data/websites ## next if ($file =~ /^\./); # Ignore anything start with dot "." next if (!-d "$websites/$file"); # Ignore if it is not a directory next if ($file =~ /hts-cache/); # Ignore if it is hts-cache dir print "[$file]\n"; ## read hts-log.txt file ## open F, "$websites/$file/hts-log.txt"; read F, $buf, 9999; close F; ## Grab the URL from the file content ## #print "[$buf]\n"; $buf=~/\d at (.*?) /; $url=$1; print "url=[$url]\n"; print "EXECUTE: hkk -q -%i -w $url -O \"/data/websites/month/$file\" -n -%P -N0 -s2 -p7 -D -a -K0 -c4 -%k -r1 -%e1 -A25000)"; system("hkk -q -%i -w $url -O \"/data/websites/month/$file\" -n -%P -N0 -s2 -p7 -D -a -K0 -c4 -%k -r1 -%e1 -A25000"); What should i put on "month" -O \"/data/websites/month/$file\" so tht the folder name will show the current month? Can you please guide me step by step? Thanks in advance.
|