Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,326 of 68,980    |
|    AlleyCat to All    |
|    Re: This Works Great, but...    |
|    19 Oct 18 00:14:12    |
   
   From: al@aohell.com   
      
   On Sat, 13 Oct 2018 19:14:21 +0700, JJ says...   
      
   >   
   > On Sat, 13 Oct 2018 02:41:36 -0500, AlleyCat wrote:   
   > > if exist D:\Latest_MSI.gho for /f "tokens=1-5 delims=/ " %%d in ("%date%")   
   > > do rename "D:\Latest_MSI.gho" %%e-%%f-%%g_MSI.gho   
   > >   
   > > That's part of a bacth file that I'm using to rename and move a ghost   
   > > image when creating a new one.   
   > >   
   > > Can anyone re-write this to make the renaming be the date modified,   
   > > instead of the current date?   
   > >   
   > > Thanks.   
   >   
   > Use below. Change "echo ren" to "ren" to make it actually perform the file   
   > rename instead of displaying the REN command line which is to be executed.   
   >   
   > @echo off   
   > setlocal   
   > for %%N in (D:\Latest_MSI.gho) do (   
   > for /f "tokens=1,2,3 delims=/ " %%X in ('echo %%~tN') do (   
   > echo ren "%%N" "%%X-%%Y-%%Z_MSI.gho"   
   > )   
   > )   
      
   Thanks! Worked great.   
      
   I've changed the batch file a bit to move the ghost files out of the   
   directory I WAS sending these ghost files to, so in CASE I was having to   
   make another ghost file that same day, it wouldn't overwrite the existing   
   file that was named after its "modified" date.   
      
   The problem with that, is that if I make one 3 times, I end up losing one,   
   unless I manually do the renaming. I'm not so lazy that I couldn't, but if   
   there's a way to automate the whole process, that's just a few more   
   moments saved. ;-)   
      
   How much more trouble would it be to add a timestamp (seconds only) to the   
   end, so it reads 10-18-2018-35.gho, or something like that? It could be   
   the current seconds or the seconds on the file timestamp, whatever is   
   easiest for you.   
      
   Thanks.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca