Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


xpd

xpd

Geek of Coastguard
14115 posts

Uber Geek
+1 received by user: 4574

Retired Mod
ID Verified
Trusted
Lifetime subscriber

#38350 28-Jul-2009 14:58
Send private message

Nice simple one for someone (i hope).... which for some reason I cant figure out or find a simple solution... :)

Ive whipped up a script (on windows 2003) as follows :

dir /S *.mp3 >c:\temp\mp3_%date%.txt

My problem is whenever it runs, the output file is "mp3_Tue" - I require the whole date preferably like 28072009 or similar.

How the fudge do I get it to do this ? All the information Ive found via Google points to running a 20 line script just to create the date variable.... gotta be easier way than that.





XPD / Gavin

 

LinkTree

 

 

 


Create new topic
BartManGeek
187 posts

Master Geek


  #239774 28-Jul-2009 15:13
Send private message

try:

dir /S *.mp3 > "c:\temp\mp3_%date%.txt"




Rural Geek - Technology Solutions

"On two occasions I have been asked [by members of Parliament!], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage



BartManGeek
187 posts

Master Geek


  #239777 28-Jul-2009 15:15
Send private message

changing the short date format under "Regional and Language options give you some variation on the format of %date%




Rural Geek - Technology Solutions

"On two occasions I have been asked [by members of Parliament!], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage

xpd

xpd

Geek of Coastguard
14115 posts

Uber Geek
+1 received by user: 4574

Retired Mod
ID Verified
Trusted
Lifetime subscriber

  #240101 29-Jul-2009 12:42
Send private message

Turns out there is no easy way.... so have to add 5-15 lines to my script to get it to work.... wouldve thought it was an easy thing to do for an advanced system like Windows :-p




XPD / Gavin

 

LinkTree

 

 

 




BartManGeek
187 posts

Master Geek


  #240104 29-Jul-2009 12:54
Send private message

ok for only an additional line of code try:
dir /S *.mp3 > c:\temp\mp3_temp.txt
ren c:\temp\mp3_temp.txt c:\temp\mp3_%date:~4,2%-%date:~7,2%-%date:~10,4%_@_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.txt

for debugging purposes use:
echo %date:~4,2%-%date:~7,2%-%date:~10,4%_@_%time:~0,2%h%time:~3,2%m%time:~6,2%s%

to play around with the formatting.




Rural Geek - Technology Solutions

"On two occasions I have been asked [by members of Parliament!], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage

xpd

xpd

Geek of Coastguard
14115 posts

Uber Geek
+1 received by user: 4574

Retired Mod
ID Verified
Trusted
Lifetime subscriber

  #240119 29-Jul-2009 13:14
Send private message

Hmm not a bad idea actually, Im not in forward thinking mode :) Thanks, Ill give that a shot :)




XPD / Gavin

 

LinkTree

 

 

 


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.