LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2010, 11:56 PM   #1
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Rep: Reputation: 15
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.
 
Old 06-22-2010, 12:48 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Hi LinpusKelvin,

What all you have tried so far ?
Which software you want to run ?
Can you please elaborate second requirement ?
 
1 members found this post helpful.
Old 06-22-2010, 01:10 AM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
2 members found this post helpful.
Old 06-22-2010, 03:30 AM   #4
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
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

Last edited by LinpusKelvin; 06-22-2010 at 03:32 AM.
 
Old 06-23-2010, 02:30 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
1 members found this post helpful.
Old 06-23-2010, 02:43 AM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Try using sprintf.
 
1 members found this post helpful.
Old 06-23-2010, 04:14 AM   #7
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
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
 
Old 06-23-2010, 09:12 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by LinpusKelvin View Post
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!
 
1 members found this post helpful.
Old 06-23-2010, 12:00 PM   #9
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
http://perldoc.perl.org/functions/sprintf.html
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Script query - trying to create a folder with an environment variable BHuckfield Linux - Server 10 05-21-2010 02:42 AM
Help with bash script to create directory to /home folder wegadnie Linux - General 5 10-25-2008 11:50 AM
Help create perl script for delete file/folder sportivo888 Linux - Newbie 5 12-05-2007 11:33 PM
perl script help required to create users and changing the owner to pericular folder sridhar11 Programming 2 10-25-2005 02:16 PM
starting script, init by copy/create file in (samba) folder? muab Linux - General 7 06-22-2005 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:46 PM.

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