This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with creating a file in the current directory and with the current time stamp

 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



In the above code i have created a new folder under the testresults folder. but i want to create the same in current directory. how do i specify the current directory as path?

and how do i name the created folder with current timestamp?

are there any methods??
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



i tired with the following code without success
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reason is a file name can't contain the following characters in windows

*\:/?<>"|
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the workaround then?
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be you could format that datetime in some other way, that doesn't contain those characters.
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks.
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why it didnt create for the following??
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your parent path doesn't end with a \. That means that your path is something like C:\\Users\\linda\\workspace\\febtemporary\\src2012-02-06_02-39-15. It wouldn't surprise me if that actually exists now.
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob


I corrected with the following line of code




 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



finally the following code worked fine. am happy with it. but i want a slight modification. how do i store my screenshots inside the dynamically created folders
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!