Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Agree with <a href="https://stackoverflow.com/questions/7769612/how-to-put-a-time-stamp-while-copying-files-in-the-for-loop-inside-the-batch-fil/7770664#7770664">@jeb</a> on all the points, however there may be another problem. Depending on your locale, the result of <code>%time%</code> may contain a leading space when the current time is before 10 in the morning. If that is so, the target path in your <code>COPY</code> command gets split, since it is not enclosed in double quotes. As a result, the command becomes syntactically incorrect.</p> <p>So, if you fix all the issues mentioned so far, your script should work without any problem. At least a simplified version of your script worked for me. Here's how I tested it:</p> <p>First, I created a simple setup on my computer:</p> <pre><code>MKDIR C:\tests\source MKDIR C:\tests\target </code></pre> <p>then copied several random files of moderate size to the <code>C:\tests\source</code> folder and ran the following script:</p> <pre><code>@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION FOR /R "C:\tests\source" %%f IN (*) DO ( SET a=!time::=! SET a=!a:,=! COPY /Y "%%f" "\!a!" ) </code></pre> <p>And this is what appeared in <code>C:\tests\target</code> as a result:</p> <pre><code>_1395459 _1395470 _1395639 </code></pre> <p>I should point out that <code>_</code> is actually a space, because on my computer the result of <code>%time%</code> indeed contains a leading space at this hour, which is between midnight and 10 a.m. in this part of the world. Anyway, my main point is, the script I posted above (which, I stress, is basically the same as yours) has worked for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload