Copy file w/o folder

I want to copy files from different folders into a single folder.  No original folder structure need.  Something like the following:
c:\xcopy d:\temp\*.* c:\test /S

However, that would create the same folder name as its' original folder.  But, I don;t need it.   Anyway to do it?  Thx!

use below command line

for /R "d:\temp" %G IN (.) DO copy %G c:\test

TOP

原帖由 davidleehk 於 2009-6-13 00:10 發表
use below command line

for /R "d:\temp" %G IN (.) DO copy %G c:\test


終於見到有人用 for
我唔識用 for

TOP

原帖由 davidleehk 於 2009-6-13 00:10 發表
use below command line

for /R "d:\temp" %G IN (.) DO copy %G c:\test

What is the meaning of %G?
It shows "G was unexpected at this time.":funk:

TOP

原帖由 WLau 於 2009-6-13 12:26 AM 發表

What is the meaning of %G?
It shows "G was unexpected at this time.":funk:


FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]

    Walks the directory tree rooted at [drive:]path, executing the FOR
    statement in each directory of the tree.  If no directory
    specification is specified after /R then the current directory is
    assumed.  If set is just a single period (.) character then it
    will just enumerate the directory tree.


Use %%G if you are using a batch file.

Enter For /? in command prompt for details!



[ 本帖最後由 madcow 於 2009-6-13 09:43 編輯 ]

TOP

原帖由 madcow 於 2009-6-13 09:42 發表


FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]

    Walks the directory tree rooted at [drive:]path, executing the FOR
    statement in each directory of the tree.  If no d ...

IC.  I have not used "for...do" many many years already.

TOP