How to rename file to date name's ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • john Bastard
    New Member
    • Aug 2010
    • 3

    How to rename file to date name's ?

    Hi EveryOne I need somebody to help me for creating a little fonction that can do this :

    For Example : The file "C:\Coco.tx t" will be renamed to : "2009-09-12-03h-12min-35sec" i think it's possible.

    have a nice day
    thank you, best regards.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    This varies by OS. Research the system calls for your operating system.

    Comment

    • john Bastard
      New Member
      • Aug 2010
      • 3

      #3
      Thanks for your attention, so i hope that this topic gonna help somebody one day 'cause i found a little code :

      int Refresh() {


      char NewLogName[30];
      time_t rawtime;
      struct tm * timeinfo;

      time ( &rawtime );
      timeinfo = localtime ( &rawtime );
      char s[100];



      strftime(s,30," %b.%d.%Y.%H.%M. %S.txt",timeinf o);


      printf(s,30,"%s ",s);

      rename("log.txt ",s);
      }

      Comment

      Working...