in reply to Re^2: Need time Stamp for folder..
in thread Relative Paths...

now i am able create a new file with Name and Date.. but when i run again its not showing folder with same name created at the same time.. am using Windows 7 machine..

I'm not sure what you mean. Can you clarify what the expected and actual results are? E.g. "I'm using your snippet from Re: Need time Stamp for folder... The first time I run it, it does FOO; the second time, I expected it to do BAR, but it actually did BAZ".

I'm guessing that what's happening is that no new folder is being created the second time. The reason for that is simple: the folder name, e.g. "man 2014-08-12", only changes when the date changes, so running the script twice on the same day will not create another folder (since, naturally, there cannot be two folders with the same name in the same parent folder).

And it's creating folder names like that because that's what the strftime flags tell it to: "%Y" is the current year (four digits), "%m" is the current month (two digits), and "%d" is the current day (two digits). If you want a finer-grained time stamp, simply adjust the format string for strftime and add more flags, as necessary/desired.

Have you read up on strftime's flags, as I suggested above?

Here's Microsoft's documentation for the function. For a finer-grained timestamp, you may want to use something "%Y-%m-%d %H-%M-%S" (which will produce e.g. "2014-08-12 08:28:45"), though I'll caution that this is still granular down to one second.

If you need to be able to (possibly) create more than one directory per second, you could use a module like Time::HiRes that provides micro- or nanosecond time. But then, this might be an example of an XY Problem, and instead of using timestamps to try and ensure that folder names are unique, you may be better off using another module that guarantees unique names.

File::Temp has a tempdir function for that purpose, for instance. And although it's intended for temporary directories, they're not automatically deleted, so the module should be suitable for this purpose:

This is the recommended interface for creation of temporary directories. By default the directory will not be removed on exit (that is, it won't be temporary; this behaviour can not be changed because of issues with backwards compatibility).

There may well be other useful modules as well.