Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Perl Script To create folder
iw_store
Hi ALL,
I have to create a Perl Script in such a way that :
The input file for the Script is :
A,B
A,C
A,D
A,E
B,F
B,G
G,H
H,I
Let us assume these letters are name of folders, by scanning this file i have to create a folder A, in that B,C,D,E AND in the B subfolder F and G folders and again in G folder H folder like that i have to maintain parent-child relationship of the input file.
If any ways or packages are there please tell me.
Now i am totally hard coding things, for creating this script.
Thanks in advance.
Find more posts tagged with
Comments
Adam Stoller
If you turn that into a list of the deepest directory paths for each directory:
A/B/F
A/B/G/H/I
A/C
A/D
You could use File:
ath::mkpath() to create them.
Is that what you were looking for?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
iw_store
Thank you fish for reply.
Iam writing a migraation script to create a folder structure inside template data and one more think input file may change, my script should be dynamic.
I am facing a hectic problem in doing this, finally i posted.
Now i will try your method.
San.
Nicholas
I think, recursive method will help, may be you are using the same.
You can also create directory using system command
system(mkdir <dirname>)
Thanks Nicholas
Adam Stoller
Do NOT use a system() command unless absolutely necessary - it's a significant waste of processing time - File:
ath::mkpath is much more efficient.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com