我有许多带有 3 位数前缀的文件。我尝试使用通配符根据前缀移动文件。我期望
move 100*.sql subdir
只会将以字符“100”开头的扩展名为 .sql 的文件移动到“subdir”文件夹,但命令结果如下。请注意,最后复制的文件以 106 为前缀,而不是 100。
D:\100-20141017-120703.sql
D:\100-20141020-150709.sql
D:\100-20141020-180711.sql
D:\100-20141021-100714.sql
D:\100-20141021-150704.sql
D:\100-20141021-180728.sql
D:\100-20141022-100729.sql
D:\100-20141022-130727.sql
D:\100-20141022-180724.sql
D:\100-20141023-100725.sql
D:\100-20141023-134946.sql
D:\100-20141024-100733.sql
D:\100-20141030-090703.sql
D:\100-20141030-100711.sql
D:\100-20141031-100712.sql
D:\100-20141101-100705.sql
D:\100-20141103-100715.sql
D:\100-20141105-100706.sql
D:\100-20141106-130709.sql
D:\100-20141110-150710.sql
D:\100-20141110-154721.sql
D:\100-20141111-160704.sql
D:\100-20141114-100705.sql
D:\106-20141029-150706.sql
24 file(s) moved.
我该如何避免这种情况。如果之前有人问过/回答过这个问题,请见谅。我搜索了但无果。
谢谢你,
答案1
问题似乎与 3 位前缀后的连字符有关。如果我在命令中包含连字符,结果是正确的:
不带连字符的结果(包括 106 个带前缀的文件):
D:\>dir 100*.sql
Directory of D:\
10/17/2014 11:07 AM 22,716 100-20141017-120703.sql
10/20/2014 02:07 PM 1,761 100-20141020-150709.sql
10/20/2014 05:07 PM 7,016 100-20141020-180711.sql
10/21/2014 09:07 AM 3,524 100-20141021-100714.sql
10/21/2014 02:07 PM 3,500 100-20141021-150704.sql
10/21/2014 05:07 PM 3,518 100-20141021-180728.sql
10/22/2014 09:07 AM 7,028 100-20141022-100729.sql
10/22/2014 12:07 PM 10,522 100-20141022-130727.sql
10/22/2014 05:07 PM 5,263 100-20141022-180724.sql
10/23/2014 09:07 AM 3,502 100-20141023-100725.sql
10/23/2014 12:49 PM 1,751 100-20141023-134946.sql
10/24/2014 09:07 AM 7,844 100-20141024-100733.sql
10/30/2014 08:07 AM 1,755 100-20141030-090703.sql
10/30/2014 09:07 AM 1,751 100-20141030-100711.sql
10/31/2014 09:07 AM 12,706 100-20141031-100712.sql
11/01/2014 09:07 AM 2,169 100-20141101-100705.sql
11/03/2014 10:07 AM 1,757 100-20141103-100715.sql
11/05/2014 10:07 AM 1,747 100-20141105-100706.sql
11/06/2014 01:07 PM 1,763 100-20141106-130709.sql
11/10/2014 03:07 PM 8,771 100-20141110-150710.sql
11/10/2014 03:47 PM 1,753 100-20141110-154721.sql
11/11/2014 04:07 PM 1,749 100-20141111-160704.sql
11/14/2014 10:07 AM 1,751 100-20141114-100705.sql
10/29/2014 02:07 PM 0 106-20141029-150706.sql
24 File(s) 115,617 bytes
带有连字符的结果(不包括以 106 为前缀的文件):
D:\>dir 100-*.sql
Directory of D:\
10/17/2014 11:07 AM 22,716 100-20141017-120703.sql
10/20/2014 02:07 PM 1,761 100-20141020-150709.sql
10/20/2014 05:07 PM 7,016 100-20141020-180711.sql
10/21/2014 09:07 AM 3,524 100-20141021-100714.sql
10/21/2014 02:07 PM 3,500 100-20141021-150704.sql
10/21/2014 05:07 PM 3,518 100-20141021-180728.sql
10/22/2014 09:07 AM 7,028 100-20141022-100729.sql
10/22/2014 12:07 PM 10,522 100-20141022-130727.sql
10/22/2014 05:07 PM 5,263 100-20141022-180724.sql
10/23/2014 09:07 AM 3,502 100-20141023-100725.sql
10/23/2014 12:49 PM 1,751 100-20141023-134946.sql
10/24/2014 09:07 AM 7,844 100-20141024-100733.sql
10/30/2014 08:07 AM 1,755 100-20141030-090703.sql
10/30/2014 09:07 AM 1,751 100-20141030-100711.sql
10/31/2014 09:07 AM 12,706 100-20141031-100712.sql
11/01/2014 09:07 AM 2,169 100-20141101-100705.sql
11/03/2014 10:07 AM 1,757 100-20141103-100715.sql
11/05/2014 10:07 AM 1,747 100-20141105-100706.sql
11/06/2014 01:07 PM 1,763 100-20141106-130709.sql
11/10/2014 03:07 PM 8,771 100-20141110-150710.sql
11/10/2014 03:47 PM 1,753 100-20141110-154721.sql
11/11/2014 04:07 PM 1,749 100-20141111-160704.sql
11/14/2014 10:07 AM 1,751 100-20141114-100705.sql
23 File(s) 115,617 bytes