1833162 Members
3210 Online
110051 Solutions
New Discussion

Help on mkdir

 
SOLVED
Go to solution
Mohd Mohtar
Frequent Advisor

Help on mkdir

Hi,

I would like to know if i can do a mkdir via script eg as follows:

1) Do a mkdir with current time attached to it in directory A - /directoryA/test1300 (1300 is the time)

Tks

regards,

Mok
8 REPLIES 8
Muthukumar_5
Honored Contributor
Solution

Re: Help on mkdir

Is 1300 denoting hour and minute?

Then,

# mkdir /directoryA/test$(date +'%H%M')

If it is minute and second then,

# mkdir /directoryA/test$(date +'%M%S')

If you want to have hour minute and second then,

# mkdir /directoryA/test$(date +'%H%M%S')

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Help on mkdir

You can go with format like __
Easy to suggest when don't know about the problem!
Joseph Loo
Honored Contributor

Re: Help on mkdir

hi mok,

try this:

# mkdir -p /directory/A/test`date +'%H%M'`

regards.
what you do not see does not mean you should not believe
Sivakumar TS
Honored Contributor

Re: Help on mkdir

Dear Mohd,

the -p option is required only when the parent directory is not present. ( In our case the directoryA).

Nothing is Impossible !
Arturo Galbiati
Esteemed Contributor

Re: Help on mkdir

Hi Mok,
mkdir /directoryA/test$(date +%H%M)

HTH,
Art
Cem Tugrul
Esteemed Contributor

Re: Help on mkdir

Hello Mohd,

you asked;
1) Do a mkdir with current time attached to it in directory A - /directoryA/test1300 (1300 is the time)

then solution would be;
mkdir /directory/A/test`date +'%H%M'`

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Mohd Mohtar
Frequent Advisor

Re: Help on mkdir

Hi All,

Thanks for reply.It works for me.

Thanks again.
Mohd Mohtar
Frequent Advisor

Re: Help on mkdir

Problem solved.