LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to create folder using script (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-folder-using-script-815568/)

LinpusKelvin 06-21-2010 11:56 PM

How to create folder using script
 
1. I wanna create a automation script to automatically run the software
2. I wanna create the folder with the format that the filename then date format.

Thanks in advance.

vinaytp 06-22-2010 12:48 AM

Hi LinpusKelvin,

What all you have tried so far ?
Which software you want to run ?
Can you please elaborate second requirement ?

evo2 06-22-2010 01:10 AM

1. I "wanna" know if you have read the man pages for mkdir and date.
2. I "wanna" know why so many people on this forum type "wanna" when they mean "want to".
3. I "wanna" know if I'm the only person that this type of thing pisses off.

Evo2.

LinpusKelvin 06-22-2010 03:30 AM

evo2: relax, sorry, i didnt know is such a sensitive words to u. Be COOL YA!!! Gentleman is a big word for u.

Dear vinaytp,

These are my source code,


use POSIX 'strftime';
$month=strftime("%m%d",localtime);#folder name month & year

if ($buf=~/\(application (.*?) \)[\r\n]/) {
$command = $1;
if ($command =~ s/-O "(.*)"/-O "$application\/$month\/
$file"/) {
$command="$application/appli $command";
print "[$command]\n";
system "$command";
}

This source code create folder in the date format. Is it possible to create the folder same as the file name and date together.

Is this clearer to u.

thanks in advance

evo2 06-23-2010 02:30 AM

Hi,

ok, I've calmed down now :-)

Looks like you are writing in perl? Sorry not I'm not at all well versed in that language. However I think I can understand enough of it to know what you are trying to do. Would you be interested in writing this as a shell script?

Evo2.

smeezekitty 06-23-2010 02:43 AM

Try using sprintf.

LinpusKelvin 06-23-2010 04:14 AM

Thanks for reply guys, I need to use perl because is CentOS.

smeezekitty: may I know what language are you using.

I am grateful for your reply.

Thanks again

catkin 06-23-2010 09:12 AM

Quote:

Originally Posted by LinpusKelvin (Post 4012383)
I need to use perl because is CentOS.

Do you mean that "the Swiss Army chainsaw of programming languages" (= Perl) is the only scripting language available on Centos? Surely this cannot be! :eek:

smeezekitty 06-23-2010 12:00 PM

http://perldoc.perl.org/functions/sprintf.html


All times are GMT -5. The time now is 02:03 AM.