|
ganjie
初级用户
 
积分 49
发帖 37
注册 2007-5-8
状态 离线
|
『楼 主』:
【已解决】只复制文件夹 不包括里面的内容
使用 LLM 解释/回答一下
小弟想复制某文件夹下的所有文件夹和子文件夹,但不复制文件夹内的文件(除了jpg与gif图片格式),这要怎么写?谢谢!
如果某文件夹内没有 jpg 或 gif 文件呢?那么还要复制该文件夹吗?要的。
不要只给我一段中文的解释说明,也不要只给我一小段代码,然后让我自己去想办法,如果是这样,谢绝回复。其实刚刚在其它论坛发贴过!
Last edited by ganjie on 2009-4-6 at 01:21 ]
Little brother wants to copy all folders and subfolders under a certain folder, but not copy the files inside the folders (except for jpg and gif image formats). How to write this? Thank you!
If there are no jpg or gif files in a certain folder? Then do we still need to copy that folder? Yes.
Last edited by ganjie on 2009-4-6 at 01:21 ]
此帖被 -5 点积分 点击查看详情 评分人:【 HAT 】 | 分数: -8 | 时间:2009-4-6 01:58 | 评分人:【 ZJHJ 】 | 分数: -4 | 时间:2009-4-6 07:15 | 评分人:【 dosihz 】 | 分数: -1 | 时间:2009-4-6 07:31 | 评分人:【 yishanju 】 | 分数: +8 | 时间:2009-4-6 09:06 |
|
|
|
2009-4-5 04:00 |
|
|
ZJHJ
高级用户
   
积分 609
发帖 374
注册 2006-8-2
状态 离线
|
|
2009-4-5 08:58 |
|
|
czl1378
初级用户
 
积分 161
发帖 114
注册 2009-2-20
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
有道理。我怎么没想到呢。。先复制所有的文件跟文件夹。然后再删除不是JPG或GIF的文件。
楼主说:“不要只给我一段中文的解释说明,也不要只给我一小段代码,然后让我自己去想办法,如果是这样,谢绝回复”。。。我在想要不要给你回呢。但是有中文解释总比没有好,对不。
That makes sense. Why didn't I think of that... First copy all the files and folders. Then delete the files that are not JPG or GIF.
The original poster said: "Don't just give me a Chinese explanation, and don't just give me a short piece of code and let me figure it out by myself. If that's the case, replies are declined"... I'm wondering if I should reply to you. But having a Chinese explanation is better than nothing, right?
|
|
2009-4-5 11:03 |
|
|
Cappuccin0
新手上路

积分 9
发帖 7
注册 2006-6-22
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
robocopy Log log2 /mir /zb /xf *.*
用robocopy拷贝在忽略掉所有文件就是了
robocopy Log log2 /mir /zb /xf *.*
Just copy using robocopy while ignoring all files
|
|
2009-4-5 11:56 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
C:\Documents and Settings\Administrator>xcopy /?
复制文件和目录树。
XCOPY source ] ]
...]
source 指定要复制的文件。
destination 指定新文件的位置和/或名称。
/A 只复制有存档属性集的文件,
但不改变属性。
/M 只复制有存档属性集的文件,
并关闭存档属性。
/D:m-d-y 复制在指定日期或指定日期以后更改的文件。
如果没有提供日期,只复制那些源时间
比目标时间新的文件。
/EXCLUDE:file1...
指定含有字符串的文件列表。每一个字符串
必须在文件的单独行中。如果有任何
字符串与要被复制的文件的绝对路径
相符,那个文件将不会得到复制。
例如,指定如 \obj\ 或 .obj 的字符串会排除
目录 obj 下面的所有文件或带有
.obj 扩展名的文件。
/P 创建每个目标文件前提示。
/S 复制目录和子目录,除了空的。
/E 复制目录和子目录,包括空的。
与 /S /E 相同。可以用来修改 /T。
/V 验证每个新文件。
/W 提示您在复制前按键。
/C 即使有错误,也继续复制。
/I 如果目标不存在,又在复制一个以上的文件,
则假定目标一定是一个目录。
/Q 复制时不显示文件名。
/F 复制时显示完整的源和目标文件名。
/L 显示要复制的文件。
/G 允许将没有经过加密的文件复制到
不支持加密的目标。
/H 也复制隐藏和系统文件。
/R 覆盖只读文件。
/T 创建目录结构,但不复制文件。
不包括空目录或子目录。/T /E 包括
空目录和子目录。
/U 只复制已经存在于目标中的文件。
/K 复制属性。一般的 Xcopy 会重置只读属性。
/N 用生成的短名复制。
/O 复制文件所有权和 ACL 信息。
/X 复制文件审核设置(隐含 /O)。
/Y 复制文件审核设置(隐含 /O)。
现存目标文件。
/-Y 导致提示以确认改写一个
现存目标文件。
/Z 用重新启动模式复制网络文件。
命令行开关 /Y 可以预先在 COPYCMD 环境变量中设置。
这可能被命令行上的 /-Y 改写。
C:\Documents and Settings\Administrator>xcopy /?
Copies files and directory trees.
XCOPY source ] ]
...]
source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
but doesn't change the attribute.
/M Copies only files with the archive attribute set,
and clears the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose source
time is newer than the destination time.
/EXCLUDE:file1...
Specifies a list of files containing strings. Each string
must be in a separate line in the file. If any string matches
the full path of the file to be copied, that file will not be copied.
For example, specifying a string like \obj\ or .obj will exclude
all files under directory obj or files with the .obj extension.
/P Prompts for creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories including empty ones.
Same as /S /E. Can be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination is a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files to be copied.
/G Allows copying unencrypted files to destinations that do not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure but does not copy files.
Does not include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy resets read-only attributes.
/N Copies using generated short names.
/O Copies file ownership and ACL information.
/X Copies file auditing settings (implies /O).
/Y Copies file auditing settings (implies /O).
Existing destination files.
/-Y Causes prompting to confirm rewriting an
existing destination file.
/Z Copies network files in restartable mode.
The command-line switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-4-5 11:59 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
尝试XCOPY /T 创建目录结构
Try XCOPY /T to create directory structure
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-4-5 11:59 |
|
|
czl1378
初级用户
 
积分 161
发帖 114
注册 2009-2-20
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
人家都说了:不要中文解释,也不要他自己想办法。yishanju兄你就发段完整代码贝
People have all said: no Chinese explanations, and no trying to figure it out by himself. Brother yishanju, just post a complete code segment.
|
|
2009-4-5 14:49 |
|
|
ganjie
初级用户
 
积分 49
发帖 37
注册 2007-5-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
不是不想办法,而是已经在想办法了,因为源文件很大的说,有上百G的文件,光是要复制过来的图片文件就有可能超G的,复制全部再删,这回贴,显然没有想想发贴人的心情,纯是不负责任的回复,但大家的热心回贴,偶也是感激的,谢谢了,偶已经自己编了三个批处理,然后用call来调用达到目的了,再次谢谢!
Last edited by ganjie on 2009-4-5 at 23:34 ]
It's not that I don't want to find a way, but that I'm already trying to find a way. Because the source file is very large, there are hundreds of gigabytes of files. The picture files alone that need to be copied might exceed a gigabyte. Copying all and then deleting, this kind of reply is obviously irresponsible without considering the poster's mood. But I'm grateful for everyone's enthusiastic replies. Thanks! I've already made three batch files by myself, and then used call to call them to achieve the goal. Thanks again!
Last edited by ganjie on 2009-4-5 at 23:34 ]
|
|
2009-4-5 23:04 |
|
|
ganjie
初级用户
 
积分 49
发帖 37
注册 2007-5-8
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
本贴的完整代码如下,已经经过测试!
@echo off
::目的文件夹名为 temp
set wjj=temp
::复制文件夹及子文件夹
for /f "delims=" %%a in ('dir/b/s/ad') do (
if not exist "%wjj%\" md "%wjj%"
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*%cd%=!
md "%wjj%!var!"
endlocal
)
::复制 jpg 和 gif 文件
for /f "delims=" %%a in ('dir/b/s/a-d *.jpg *.gif') do (
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*%cd%=!
copy /y "%%a" "%wjj%!var!"
endlocal
)
pause
感谢批处理论坛的随风。
The complete code of this post is as follows, and it has been tested!
@echo off
::The target folder name is temp
set wjj=temp
::Copy folders and subfolders
for /f "delims=" %%a in ('dir/b/s/ad') do (
if not exist "%wjj%\" md "%wjj%"
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*%cd%=!
md "%wjj%!var!"
endlocal
)
::Copy jpg and gif files
for /f "delims=" %%a in ('dir/b/s/a-d *.jpg *.gif') do (
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*%cd%=!
copy /y "%%a" "%wjj%!var!"
endlocal
)
pause
Thanks to Suifeng from the batch processing forum.
|
|
2009-4-6 08:45 |
|
|
dosz
中级用户
   一看二跟三动手
积分 396
发帖 188
注册 2005-10-23 来自 上海
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
1,创建相同之文件夹。
2,复制图片之文件。
有理。
1, Create the same folder.
2, Copy the image file.
Reasonable.
|

*/. . . * .
.\* . * dosz
*/ . ./\~~~~~~~~~~~~'\. ^|◆
\* ,/,..,\,...........,\.◆
^|^| ..▎# ▎田 田 ▎ ^| ▎◆
^|^| ^&^&▎ ▎ ▎'^|'▎ o
^|^| ##■■■■■■■■■■〓 |
|
2009-4-6 09:33 |
|
|
balinger
中级用户
  
积分 356
发帖 115
注册 2004-7-27
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
哎,可惜楼主的系统里没有XCOPY!
Hey, it's a pity that the original poster's system doesn't have XCOPY!
|
|
2009-4-6 09:43 |
|
|
dosz
中级用户
   一看二跟三动手
积分 396
发帖 188
注册 2005-10-23 来自 上海
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
Originally posted by balinger at 2009-4-6 09:43:
哎,可惜楼主的系统里没有XCOPY!
要是这样的话,那是『第 2 楼』的”先复制再删除“
Originally posted by balinger at 2009-4-6 09:43:
Hey, it's a pity that there's no XCOPY in the owner's system!
If that's the case, then it's the "copy first and then delete" in the "2nd floor"
|

*/. . . * .
.\* . * dosz
*/ . ./\~~~~~~~~~~~~'\. ^|◆
\* ,/,..,\,...........,\.◆
^|^| ..▎# ▎田 田 ▎ ^| ▎◆
^|^| ^&^&▎ ▎ ▎'^|'▎ o
^|^| ##■■■■■■■■■■〓 |
|
2009-4-6 10:22 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
|
2009-4-6 11:47 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
不是不想办法,而是已经在想办法了,因为源文件很大的说,有上百G的文件,光是要复制过来的图片文件就有可能超G的,复制全部再删,这回贴,显然没有想想发贴人的心情,纯是不负责任的回复
你为啥不在顶楼说明源文件很大?这不是浪费别人的时间嘛?你总觉得别人回复不负责任,为啥不想想自己的提问方式是否负责人?你考虑过帮你解决问题的人的心情么?
It's not that I don't want to find a way, but that I'm already trying to find a way. Because the source file is very large, there are hundreds of gigabytes of files. The image files alone may exceed a gigabyte. Copying all and then deleting, and then posting back, is obviously an irresponsible reply without considering the mood of the person who posted it.
Why didn't you state at the top that the source file is very large? Isn't this a waste of other people's time? You always feel that others' replies are irresponsible, why don't you think about whether your own way of asking questions is responsible? Have you considered the mood of the person who is helping you solve the problem?
|

 |
|
2009-4-6 13:03 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Originally posted by balinger at 2009-4-6 09:43 AM:
哎,可惜楼主的系统里没有XCOPY!
你从什么总结出楼主的系统没有XCOPY?
Originally posted by balinger at 2009-4-6 09:43 AM:
Hey, it's a pity that the owner's system doesn't have XCOPY!
What did you conclude that the owner's system doesn't have XCOPY from?
|

 |
|
2009-4-6 13:04 |
|