|
nbic
初级用户
 
积分 135
发帖 61
注册 2007-4-14
状态 离线
|
『楼 主』:
DOS能否只复制文件夹子目录里面的文件
使用 LLM 解释/回答一下
有一个文件夹A。其里面的子文件夹不少,DOS能不能完成,只复制A文件夹里面所有的文件,而不包括子文件夹(即,排除子文件夹)
如果可以,该如何做到呢?
先谢过!
There is a folder A. There are quite a few subfolders inside it. Can DOS complete the task of only copying all the files in folder A without including the subfolders (that is, excluding the subfolders)? If it can, how to do it? Thanks in advance!
|
|
2007-5-23 23:56 |
|
|
fengzi
中级用户
   金牌会员
积分 315
发帖 152
注册 2007-1-25
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
copy A\*.* 2\
应该可以哦```不会复制A目录子目录里的东西
路径自己更改`
Last edited by fengzi on 2007-5-24 at 04:35 AM ]
copy A\*.* 2\
Should be okay```It won't copy the contents of subdirectories in directory A
Change the path yourself`
Last edited by fengzi on 2007-5-24 at 04:35 AM ]
|
|
2007-5-24 04:06 |
|
|
nbic
初级用户
 
积分 135
发帖 61
注册 2007-4-14
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by fengzi at 2007-5-24 04:06 AM:
copy A\*.* 2\
应该可以哦```不会复制A目录子目录里的东西
路径自己更改`
Last edited by fengzi on 2007-5-24 at 04:35 AM ]
最后面的2\是?
其实我想把A子目录里面的所有文件也复制哦。但需要排除A中的子文件夹。
比如说吧:A里面有B、C、...、F这么几个子文件夹,我想只通过一个命令,就将B~F里面所有的文件复制到G。而排除B、C、...、F这些子文件夹。
Last edited by nbic on 2007-5-24 at 06:24 AM ]
Originally posted by fengzi at 2007-5-24 04:06 AM:
copy A\*.* 2\
It should work```It won't copy the contents of subdirectories in directory A
Change the path yourself`
Last edited by fengzi on 2007-5-24 at 04:35 AM ]
What is the 2\ at the end?
Actually, I want to copy all files inside subdirectory A. But I need to exclude the subfolders in A.
For example: There are subdirectories B, C, ..., F in A. I want to copy all files in B to F to G with just one command, and exclude subdirectories B, C, ..., F.
Last edited by nbic on 2007-5-24 at 06:24 AM ]
|
|
2007-5-24 06:19 |
|
|
qinbuer
高级用户
    我思故我在
积分 512
发帖 228
注册 2007-1-21
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
直接copy该文件夹就行了,如copy A:\B G:
copy会排除B文件夹中的子文件夹
Just copy the folder directly. For example, copy A:\B G:
copy will exclude the subfolders in folder B
|
|
2007-5-24 10:12 |
|
|
nbic
初级用户
 
积分 135
发帖 61
注册 2007-4-14
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
Originally posted by qinbuer at 2007-5-24 10:12 AM:
直接copy该文件夹就行了,如copy A:\B G:
copy会排除B文件夹中的子文件夹
这个只有在B里面没有子文件夹下才行的啊。。问题是。在目录树比较长的情况下,不会要把每个路径都写出来吧。。?那样不是很麻烦。而且。B里面的子文件夹的数目是会改变的。。要是写路径,这个就更难了。。
Originally posted by qinbuer at 2007-5-24 10:12 AM:
Just copy the entire folder, for example, copy A:\B G:
copy will exclude subfolders within folder B
This only works if there are no subfolders in B. The problem is, when the directory tree is long, do we have to write out each path? That would be very cumbersome. Moreover, the number of subfolders in B can change. If we have to write the paths, it would be even more difficult.
|
|
2007-5-24 10:38 |
|
|
qinbuer
高级用户
    我思故我在
积分 512
发帖 228
注册 2007-1-21
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
有文件夹一样可以,比如B文件家下有test文件夹和test.txt文本,copy A:\b只会复制test.txt文本,你应该试一下再发问
Having a folder is also okay. For example, there is a test folder and a test.txt text file under folder B. Copying A:\b will only copy the test.txt text file. You should try it before asking questions.
|
|
2007-5-24 10:42 |
|
|
nbic
初级用户
 
积分 135
发帖 61
注册 2007-4-14
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by qinbuer at 2007-5-24 10:42 AM:
有文件夹一样可以,比如B文件家和test.txt文本,copy A:\b只会复制test.txt文本,你应该试一下再发问
估计你还没有明白我的意思。不是我没试过,是我早试过了。
比如B文件家下有test文件夹和test.txt文本。你能不能copy A:\b 然后将B里面所有的文件都复制出来。而排除test文件夹呢?要求不要将路径延伸到test子文件夹里面。。
Originally posted by qinbuer at 2007-5-24 10:42 AM:
It's okay to have a folder. For example, there is a folder B and a text file test.txt. Copying A:\b will only copy the text file test.txt. You should try it before asking.
I guess you still don't understand what I mean. It's not that I haven't tried, but that I have tried it long ago.
For example, there is a folder test and a text file test.txt under folder B. Can you copy A:\b and then copy all the files in B, excluding the folder test? The requirement is not to extend the path to the subfolder test.
|
|
2007-5-24 11:57 |
|
|
terse
银牌会员
    
积分 2404
发帖 946
注册 2005-9-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
for /r D:\xy %%a in (*.*) do xcopy %%a e:\xy\
for /r D:\xy %%a in (*.*) do xcopy %%a e:\xy\
|
|
2007-5-24 12:54 |
|
|
zhoushijay
高级用户
    Autowalk
积分 845
发帖 375
注册 2007-3-3
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
可以用 dir /a-d 来找COPY的路径,排除目录
Last edited by zhoushijay on 2007-5-24 at 12:58 PM ]
You can use dir /a-d to find the path of COPY, excluding directories
Last edited by zhoushijay on 2007-5-24 at 12:58 PM ]
|

你好,脚本专家!
<a target=blank href=tencent://message/?uin=29654761&Site=www.111.com&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:29654761:5 alt="点击这里给我发消息"></a> |
|
2007-5-24 12:57 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
没处理含空格文件名的文件和文件夹
将d:\a文件夹里的子文件夹里的文件复制到e:\abc
大致思路这样,没测试....
@echo off
for /f %%i in ('dir/ad/b d:\a') call :lis %%i
goto :eof
:lis
for /r %1 %%j in (*.*) do xcopy/y/e %%j e:\abc\
goto :eof
Files and folders with filenames containing spaces were not handled.
Copy the files in the subfolders in the d:\a folder to e:\abc.
The general idea is like this, not tested....
@echo off
for /f %%i in ('dir/ad/b d:\a') call :lis %%i
goto :eof
:lis
for /r %1 %%j in (*.*) do xcopy/y/e %%j e:\abc\
goto :eof
|
|
2007-6-13 00:19 |
|