dos trick 2

Posted on June 14, 2007. Filed under: dos trick |

create dynamic folder base on current date, in dos, note in dos

suatu hari temen gwa nanya ke gwa… gimana caranya create folder berdasarkan tgl hari itu secara dynamic, mulanya gwa pikir wahhh piece o’ cake untill he said, in dos command, what the fck, slintas terpikir untuk pake j script or wsh script, tapi karena tertantang, jadi aja gwa jabanin, malam itu tanpa koneksi internet dan hanya bermodal help window terciptalah dos command antik berikut inih

C:\>for /F “tokens=1,2,3* delims=/” %i in (`date /t`) do @echo %i %j %k
The system cannot find the file `date.

C:\>for /F “tokens=1,2,3* delims=/” %i in (‘date /t’) do @echo %i %j %k
16 05 2007

C:\>for /F “tokens=1,2,3* delims=/” %i in (‘date /t’) do @mkdir %i\%j\%k

C:\>for /F “tokens=1,2,3* delims=/” %i in (‘date /t’) do @mkdir %i%j%k

C:\>for /F “tokens=1,2,3* delims=/” %i in (‘date /t’) do @mkdir %j%i%k

Make a Comment

Make a Comment: ( 4 so far )

blockquote and a tags work here.

4 Responses to “dos trick 2”

RSS Feed for BlueJune Comments RSS Feed

gileee.. hebat banget lo men.. inilah tipikal anak IT sejati, sekalinya gak ketemu jalan keluar, di tongkrongin ampe selesai.. wuoee.. lo kesini deh, bantuin gw.. bisa-bisa g1 berevolusi huehehe..

and now…still in dos command of course
i want to copy a file to those folder
using batch file…
so every day or week perhaps i found a dated folder name with a file in it….
it really usefull for auto backup….
coz usualy my everyday backup event overwrite old back up file instead of copying it on another dated folder…….

@echo off
MD Coba
xcopy d:\databasenya F:\coba /s
for /F “tokens=2-4 delims=/ ” %%i in (‘date /t’) do rename coba HNRBackUP_%%k_%%i_%%j

letakan di batch file anda… atur jadwal and done

thx h :p can’t wait to test it :p


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...