File: dired.texi

package info (click to toggle)
emacs-manual-ja 20.5-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,964 kB
  • ctags: 12
  • sloc: lisp: 119; ansic: 69; makefile: 43; sh: 28
file content (1594 lines) | stat: -rw-r--r-- 73,670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
@c =============================================================
@c = $B85(B $BK](B $BLu(B: $BGt@n@5=<!w$*Cc$N?e=w;RBg3X(B
@c = $B2CI.=$@5(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1998/11/25
@c = 20.4$B2~D{(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1999/09/12
@c =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Dired, Calendar/Diary, Rmail, Top
@c @chapter Dired, the Directory Editor
@chapter $B%G%#%l%/%H%j%(%G%#%?(Bdired
@c @cindex Dired
@cindex dired

@c   Dired makes an Emacs buffer containing a listing of a directory, and
@c optionally some of its subdirectories as well.  You can use the normal
@c Emacs commands to move around in this buffer, and special Dired commands
@c to operate on the files listed.
dired$B$O%G%#%l%/%H%j0lMw$r%P%C%U%!$K:n@.$7$^$9!#(B
$B>l9g$K$h$C$F$O!"%5%V%G%#%l%/%H%j$N0lMw$b4^$^$l$^$9!#(B
$BIaDL$N(BEmacs$B%3%^%s%I$G$3$N%P%C%U%!$NCf$rF0$-2v$C$?$j!"(B
$BFCJL$J(Bdired$B%3%^%s%I$G0lMwCf$K$"$k%U%!%$%k$rA`:n$G$-$^$9!#(B

@menu
* Enter: Dired Enter.         How to invoke Dired.
* Commands: Dired Commands.   Commands in the Dired buffer.
* Deletion: Dired Deletion.   Deleting files with Dired.
* Flagging Many Files::       Flagging files based on their names.
* Visit: Dired Visiting.      Other file operations through Dired.
* Marks vs Flags::	      Flagging for deletion vs marking.
* Operating on Files::	      How to copy, rename, print, compress, etc.
			        either one file or several files.
* Shell Commands in Dired::   Running a shell command on the marked files.
* Transforming File Names::   Using patterns to rename multiple files.
* Comparison in Dired::	      Running `diff' by way of Dired.
* Subdirectories in Dired::   Adding subdirectories to the Dired buffer.
* Subdirectory Motion::	      Moving across subdirectories, and up and down.
* Hiding Subdirectories::     Making subdirectories visible or invisible.
* Updating: Dired Updating.   Discarding lines for files of no interest.
* Find: Dired and Find.	      Using `find' to choose the files for Dired.
@end menu

@node Dired Enter
@c @section Entering Dired
@section dired$B$N5/F0(B

@findex dired
@kindex C-x d
@vindex dired-listing-switches
@c   To invoke Dired, do @kbd{C-x d} or @kbd{M-x dired}.  The command reads
@c a directory name or wildcard file name pattern as a minibuffer argument
@c to specify which files to list.  Where @code{dired} differs from
@c @code{list-directory} is in putting the buffer into Dired mode so that
@c the special commands of Dired are available.
dired$B$r5/F0$9$k$K$O!"(B@kbd{C-x d}$B$+(B@kbd{M-x dired}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"0lMwI=<($9$k%U%!%$%k$r;XDj$9$k$?$a$N(B
$B%G%#%l%/%H%jL>$d%U%!%$%k$N%o%$%k%I%+!<%I%Q%?!<%s$r%_%K%P%C%U%!$GFI$_<h$j$^$9!#(B
@code{dired}$B$,(B@code{list-directory}$B$H0c$&$N$O!"(B
$B%P%C%U%!$,(Bdired$B%b!<%I$K$J$C$F$$$F(B
$BFCJL$J(Bdired$B%3%^%s%I$r;H$($k$h$&$K$J$k$3$H$G$9!#(B

@c   The variable @code{dired-listing-switches} specifies the options to
@c give to @code{ls} for listing directory; this string @emph{must} contain
@c @samp{-l}.  If you use a numeric prefix argument with the @code{dired}
@c command, you can specify the @code{ls} switches with the minibuffer
@c before you enter the directory specification.
$BJQ?t(B@code{dired-listing-switches}$B$K$O!"(B
$B%G%#%l%/%H%j0lMw$r:n@.$9$k(B@code{ls}$B%W%m%0%i%`$KM?$($k%*%W%7%g%s$r;XDj$7$^$9!#(B
$B%*%W%7%g%sCf$K$O(B@samp{-l}$B$,I,$:4^$^$l$F$$$k(B@emph{$BI,MW(B}$B$,$"$j$^$9!#(B
@code{dired}$B%3%^%s%I$K?t0z?t$r;XDj$9$k$H!"(B
$B%_%K%P%C%U%!$G%G%#%l%/%H%j$r;XDj$9$k$^$($K(B
@code{ls}$B$N%*%W%7%g%s$r;XDj$G$-$^$9!#(B

@findex dired-other-window
@kindex C-x 4 d
@findex dired-other-frame
@kindex C-x 5 d
@c   To display the Dired buffer in another window rather than in the
@c selected window, use @kbd{C-x 4 d} (@code{dired-other-window}) instead
@c of @kbd{C-x d}.  @kbd{C-x 5 d} (@code{dired-other-frame}) uses a
@c separate frame to display the Dired buffer.
dired$B%P%C%U%!$r8=:_A*Br$7$F$$$k%&%#%s%I%&$G$O$J$/(B
$BJL$N%&%#%s%I%&$KI=<($7$?$$>l9g$K$O!"(B
@kbd{C-x d}$B$N$+$o$j$K(B@kbd{C-x 4 d}$B!J(B@code{dired-other-window}$B!K$r;H$$$^$9!#(B
@kbd{C-x 5 d}$B!J(B@code{dired-other-frame}$B!K$O(B
$BJL$N%U%l!<%`$K(Bdired$B%P%C%U%!$rI=<($7$^$9!#(B

@node Dired Commands
@c @section Commands in the Dired Buffer
@section dired$B%P%C%U%!Fb$N%3%^%s%I(B

@c     The Dired buffer is ``read-only,'' and inserting text in it is not
@c useful, so ordinary printing characters such as @kbd{d} and @kbd{x} are
@c used for special Dired commands.  Some Dired commands @dfn{mark} or
@c @dfn{flag} the @dfn{current file} (that is, the file on the current
@c line); other commands operate on the marked files or on the flagged
@c files.
dired$B%P%C%U%!$O!XFI$_=P$7@lMQ!Y$G$"$j!"(B
$B$3$N%P%C%U%!$KJ8;z$rA^F~$7$F$b0UL#$,$J$$$N$G!"(B
@kbd{d}$B$d(B@kbd{x}$B$N$h$&$JDL>o$N0u;zJ8;z$OFCJL$J(Bdired$B%3%^%s%I$K;H$o$l$^$9!#(B
dired$B%3%^%s%I$N$$$/$D$+$O!"(Bdired$B%P%C%U%!$N(B
@dfn{$B%+%l%s%H%U%!%$%k(B}$B!J(Bcurrent file$B!"$D$^$j!"8=:_9T$N%U%!%$%k!K$K(B
@dfn{$B0u(B}$B!J(Bmark$B!K$d(B@dfn{$B%U%i%0(B}$B!J(Bflag$B!K$rIU$1$^$9!#(B
$BB>$N%3%^%s%I$O!"0u$d%U%i%0$,IU$$$?%U%!%$%k72$K:nMQ$7$^$9!#(B

@c @kindex C-n @r{(Dired)}
@c @kindex C-p @r{(Dired)}
@kindex C-n @r{$B!J(Bdired$B!K(B}
@kindex C-p @r{$B!J(Bdired$B!K(B}
@c   All the usual Emacs cursor motion commands are available in Dired
@c buffers.  Some special-purpose cursor motion commands are also
@c provided.  The keys @kbd{C-n} and @kbd{C-p} are redefined to put the
@c cursor at the beginning of the file name on the line, rather than at the
@c beginning of the line.
Emacs$B$NIaDL$N%+!<%=%k0\F0%3%^%s%I$O(Bdired$B%P%C%U%!$G$b;H$($^$9!#(B
$BFC<lMQES$N%+!<%=%k0\F0%3%^%s%I$b$"$j$^$9!#(B
@kbd{C-n}$B$H(B@kbd{C-p}$B$O!"%+!<%=%k$r9T$N@hF,$G$O$J$/(B
$B%U%!%$%kL>$N@hF,$K0LCV9g$o$;$9$k$h$&$K:FDj5A$5$l$F$$$^$9!#(B

@c @kindex SPC @r{(Dired)}
@kindex SPC @r{$B!J(Bdired$B!K(B}
@c   For extra convenience, @key{SPC} and @kbd{n} in Dired are equivalent
@c to @kbd{C-n}.  @kbd{p} is equivalent to @kbd{C-p}.  (Moving by lines is
@c so common in Dired that it deserves to be easy to type.)  @key{DEL}
@c (move up and unflag) is often useful simply for moving up.
$B$5$i$KJXMx$J$h$&$K!"(B
dired$B%b!<%I$G$O(B@key{SPC}$B$H(B@kbd{n}$B$O(B@kbd{C-n}$B$KEy2A$G$9!#(B
@kbd{p}$B$O(B@kbd{C-p}$B$KEy2A$G$9!#(B
$B!J(Bdired$B$G$O9TC10L$N0\F0$r$h$/9T$&$?$a!"BG80$7$d$9$/$7$F$"$k!#!K(B
@key{DEL}$B!J>e$K0\F0$7$F%U%i%0$r>C$9!K$O!"C1$K>e$X0\F0$9$k>l9g$K$OJXMx$G$9!#(B

@node Dired Deletion
@c @section Deleting Files with Dired
@section dired$B$G$N%U%!%$%k:o=|(B
@c @cindex flagging files (in Dired)
@c @cindex deleting files (in Dired)
@cindex $B%U%!%$%k$K%U%i%0$rIU$1$k!J(Bdired$B!K(B
@cindex $B%U%!%$%k$N:o=|!J(Bdired$B!K(B

@c   The primary use of Dired is to @dfn{flag} files for deletion and then
@c delete the files previously flagged.
dired$B$N<g$JMxMQK!$O!"%U%!%$%k$K:o=|$N%U%i%0$rIU$1$F$+$i!"(B
$B%U%i%0$NIU$$$F$$$k%U%!%$%k$r!JK\Ev$K!K:o=|$9$k$3$H$G$9!#(B

@table @kbd
@item d
@c Flag this file for deletion.
$B$3$N%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B
@item u
@c Remove deletion flag on this line.
$B$3$N9T$N:o=|%U%i%0$r>C$9!#(B
@item @key{DEL}
@c Move point to previous line and remove the deletion flag on that line.
$B%]%$%s%H$r$^$($N9T$K0\$7!"$=$N9T$N:o=|%U%i%0$r>C$9!#(B
@item x
@c Delete the files that are flagged for deletion.
$B:o=|%U%i%0$,IU$$$?%U%!%$%k$r!JK\Ev$K!K:o=|$9$k!#(B
@end table

@c @kindex d @r{(Dired)}
@kindex d @r{$B!J(Bdired$B!K(B}
@findex dired-flag-file-deletion
@c   You can flag a file for deletion by moving to the line describing the
@c file and typing @kbd{d} (@code{dired-flag-file-deletion}).  The deletion flag is visible as a @samp{D} at
@c the beginning of the line.  This command moves point to the next line,
@c so that repeated @kbd{d} commands flag successive files.  A numeric
@c argument serves as a repeat count.
$B%U%!%$%k$K:o=|%U%i%0$rIU$1$k$K$O!"(B
$B$=$N%U%!%$%k$rI=<($7$F$$$k9T$K0\F0$7$F(B@kbd{d}$B$HBG$A$^$9!#(B
$B:o=|%U%i%0$O!"9TF,$KI=<($5$l$k(B@samp{D}$B$H$$$&J8;z$G$o$+$j$^$9!#(B
$B$3$N%3%^%s%I$O%]%$%s%H$r$D$.$N9T$K?J$a$^$9$+$i!"(B
@kbd{d}$B%3%^%s%I$r7+$jJV$7<B9T$9$l$P8eB3$N%U%!%$%k$K$b%U%i%0$r(B
$BIU$1$k$3$H$,$G$-$^$9!#(B
$B?t0z?t$OH?I|2s?t$K$J$j$^$9!#(B

@c @kindex u @r{(Dired deletion)}
@c @kindex DEL @r{(Dired)}
@kindex u @r{$B!J(Bdired$B$N:o=|!K(B}
@kindex DEL @r{$B!J(Bdired$B!K(B}
@c   The files are flagged for deletion rather than deleted immediately to
@c reduce the danger of deleting a file accidentally.  Until you direct
@c Dired to expunge the flagged files, you can remove deletion flags using
@c the commands @kbd{u} and @key{DEL}.  @kbd{u} (@code{dired-unmark}) works
@c just like @kbd{d}, but removes flags rather than making flags.
@c @key{DEL} (@code{dired-unmark-backward}) moves upward, removing flags;
@c it is like @kbd{u} with argument @minus{}1.
$BB(:B$K%U%!%$%k$r:o=|$9$k$+$o$j$K:o=|%U%i%0$rIU$1$k$N$G!"(B
$B8m$C$F%U%!%$%k$r>C$7$F$7$^$&4m81@-$ODc$/$J$j$^$9!#(B
$B%U%i%0$rIU$1$?%U%!%$%k$rKu>C$9$k$h$&$K(Bdired$B$K;X<($9$k$^$G$O!"(B
@kbd{u}$B$d(B@key{DEL}$B$r;H$C$F:o=|%U%i%0$r>C$;$^$9!#(B
@kbd{u}$B!J(B@code{dired-unmark}$B!K$O!"(B@kbd{d}$B$HF1$8$h$&$KF0:n$7$^$9$,!"(B
$B%U%i%0$rIU$1$k$N$G$O$J$/%U%i%0$r>C$7$^$9!#(B
@kbd{DEL}$B!J(B@code{dired-unmark-backward}$B!K$O>e$K0\F0$7$F%U%i%0$r>C$7$^$9!#(B
$B$3$l$O!"?t0z?t(B@minus{}1$B$r;XDj$7$?(B@kbd{u}$B$HF1$8$G$9!#(B

@c @kindex x @r{(Dired)}
@kindex x @r{$B!J(Bdired$B!K(B}
@findex dired-expunge
@c @cindex expunging (Dired)
@cindex $BKu>C!J(Bdired$B!K(B
@c   To delete the flagged files, type @kbd{x} (@code{dired-expunge}).
@c This command first displays a list of all the file names flagged for
@c deletion, and requests confirmation with @kbd{yes}.  If you confirm,
@c Dired deletes the flagged files, then deletes their lines from the text
@c of the Dired buffer.  The shortened Dired buffer remains selected.
$B:o=|%U%i%0$,IU$$$?%U%!%$%k$r!JK\Ev$K!K:o=|$9$k$K$O!"(B
@kbd{x}$B!J(B@code{dired-expunge}$B!K$HBG$A$^$9!#(B
$B$3$N%3%^%s%I$O!":o=|%U%i%0$,IU$$$?%U%!%$%k$N0lMw$rI=<($7!"(B
@kbd{yes}$B$G$N3NG'1~Ez$r5a$a$^$9!#(B
$B3NG'$9$k$H(Bdired$B$O%U%i%0$,IU$$$?%U%!%$%k$r:o=|$7!"(B
dired$B%P%C%U%!$+$i$=$l$i$KBP1~$9$k9T$r:o=|$7$^$9!#(B
$B>.$5$/$J$C$?(Bdired$B%P%C%U%!$OA*Br$5$l$?$^$^$G$9!#(B

@c   If you answer @kbd{no} or quit with @kbd{C-g} when asked to confirm, you
@c return immediately to Dired, with the deletion flags still present in
@c the buffer, and no files actually deleted.
$B3NG'$K(B@kbd{no}$B$HEz$($?$j!"(B@kbd{C-g}$B$GCfCG$9$k$H!"(B
$B$?$@$A$K(Bdired$B$KLa$j$^$9$,!":o=|%U%i%0$OIU$$$?$^$^$G!"(B
$B%U%!%$%k$r<B:]$K:o=|$7$^$;$s!#(B

@node Flagging Many Files
@c @section Flagging Many Files at Once
@section $B0lEY$KB??t$N%U%!%$%k$K%U%i%0$rIU$1$k(B

@table @kbd
@item #
@c Flag all auto-save files (files whose names start and end with @samp{#})
@c for deletion (@pxref{Auto Save}).
$B!JL>A0$,(B@samp{#}$B$G;O$^$j(B@samp{#}$B$G=*$k!K(B
$B$9$Y$F$N<+F0J]B8%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B
$B!J(B@pxref{Auto Save}$B!K!#(B

@item ~
@c Flag all backup files (files whose names end with @samp{~}) for deletion
@c (@pxref{Backup}).
$B!JL>A0$,(B@samp{~}$B$G=*$k!K$9$Y$F$N%P%C%/%"%C%W%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B
$B!J(B@pxref{Backup}$B!K!#(B

@item &
@c Flag for deletion all files with certain kinds of names, names that
@c suggest you could easily create the files again.
$B4JC1$K:n@.$7D>$;$k$h$&$JL>A0$N$9$Y$F$N%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B

@c @item .@: @r{(Period)}
@item .@: @r{$B!J%T%j%*%I!K(B}
@c Flag excess numeric backup files for deletion.  The oldest and newest
@c few backup files of any one file are exempt; the middle ones are
@c flagged.
$BM>J,$JHV9fIU$-%P%C%/%"%C%W%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B
$B?7$7$$%P%C%/%"%C%W%U%!%$%k?t8D$H8E$$$N$b$N?t8D$r=|$$$F!"(B
$B$=$N$"$$$@$N$b$N$K%U%i%0$rIU$1$k!#(B

@item % d @var{regexp} @key{RET}
@c Flag for deletion all files whose names match the regular expression
@c @var{regexp}.
$BL>A0$,@55,I=8=(B@var{regexp}$B$K0lCW$9$k$9$Y$F$N%U%!%$%k$K:o=|%U%i%0$rIU$1$k!#(B
@end table

@c   The @kbd{#}, @kbd{~}, @kbd{&}, and @kbd{.} commands flag many files for
@c deletion, based on their file names.  These commands are useful
@c precisely because they do not themselves delete any files; you can
@c remove the deletion flags from any flagged files that you really wish to
@c keep.@refill
@kbd{#}$B!"(B@kbd{~}$B!"(B@kbd{&}$B!"(B@kbd{.}$B$N%3%^%s%I$O!"(B
$B%U%!%$%kL>$K4p$E$$$F?tB?$/$N%U%!%$%k$K:o=|%U%i%0$rIU$1$^$9!#(B
$B$3$l$i$N%3%^%s%I$OK\Ev$KJXMx$G$9!#(B
$B$H$$$&$N$O!"%U%!%$%k$r<B:]$K$O:o=|$7$J$$$+$i$G$9!#(B
$B;D$7$F$*$-$?$$%U%!%$%k$N:o=|%U%i%0$O>C$;$P$$$$$N$G$9!#(B

@c @kindex & @r{(Dired)}
@kindex & @r{$B!J(Bdired$B!K(B}
@findex dired-flag-garbage-files
@vindex dired-garbage-files-regexp
@c   @kbd{&} (@code{dired-flag-garbage-files}) flags files whose names
@c match the regular expression specified by the variable
@c @code{dired-garbage-files-regexp}.  By default, this matches certain
@c files produced by @TeX{}, and the @samp{.orig} and @samp{.rej} files
@c produced by @code{patch}.
@kbd{&}$B!J(B@code{dired-flag-garbage-files}$B!K$O!"(B
$BJQ?t(B@code{dired-garbage-files-regexp}$B$G;XDj$5$l$k(B
$B@55,I=8=$K0lCW$9$kL>A0$N%U%!%$%k$K:o=|%U%i%0$rIU$1$^$9!#(B
$B%G%U%)%k%H$O!"(B@TeX{}$B$,@8@.$9$k$"$k<o$N%U%!%$%k$H(B
@code{patch}$B%W%m%0%i%`(B
@footnote{$B!ZLuCm![?t<oN`$N7A<0$N(B@code{diff}$B$N=PNO$r2r<a$7$F!"(B
$B%F%-%9%H%U%!%$%k$r99?7$9$k$?$a$N%W%m%0%i%`(B}
$B$,@8@.$9$k(B@samp{.orig}$B$H(B
@samp{.rej}$B$N%U%!%$%k$G$9!#(B

@c @kindex # @r{(Dired)}
@c @kindex ~ @r{(Dired)}
@kindex # @r{$B!J(Bdired$B!K(B}
@kindex ~ @r{$B!J(Bdired$B!K(B}
@findex dired-flag-auto-save-files
@findex dired-flag-backup-files
@c   @kbd{#} (@code{dired-flag-auto-save-files}) flags for deletion all
@c files whose names look like auto-save files (@pxref{Auto Save})---that
@c is, files whose names begin and end with @samp{#}.  @kbd{~}
@c (@code{dired-flag-backup-files}) flags for deletion all files whose
@c names say they are backup files (@pxref{Backup})---that is, whose names
@c end in @samp{~}.
@kbd{#}$B!J(B@code{dired-flag-auto-save-files}$B!K$O!"(B
$B<+F0J]B8%U%!%$%k$H;W$o$l$kL>A0$N%U%!%$%k!"(B
$B$9$J$o$A!"L>A0$,(B@samp{#}$B$G;O$^$j(B@samp{#}$B$G=*$k$b$N(B
$B$9$Y$F$K:o=|%U%i%0$rIU$1$^$9!#(B
@kbd{~}$B!J(B@code{dired-flag-backup-files}$B!K$O!"(B
$B%P%C%/%"%C%W%U%!%$%k$H;W$o$l$kL>A0$N%U%!%$%k!"(B
$B$9$J$o$A!"L>A0$,(B@samp{~}$B$G=*$k$b$N$9$Y$F$K:o=|%U%i%0$rIU$1$^$9!#(B

@c @kindex . @r{(Dired)}
@kindex . @r{$B!J(Bdired$B!K(B}
@vindex dired-kept-versions
@findex dired-clean-directory
@c   @kbd{.} (period, @code{dired-clean-directory}) flags just some of the
@c backup files for deletion: all but the oldest few and newest few backups
@c of any one file.  Normally @code{dired-kept-versions} (@strong{not}
@c @code{kept-new-versions}; that applies only when saving) specifies the
@c number of newest versions of each file to keep, and
@c @code{kept-old-versions} specifies the number of oldest versions to
@c keep.
@kbd{.}$B!J%T%j%*%I!"(B@code{dired-clean-directory}$B!K$O!"(B
$B%P%C%/%"%C%W%U%!%$%k$N$$$/$D$+!"$D$^$j!"(B
$B8E$$$b$N?t8D$H?7$7$$$b$N?t8D$r=|$/$9$Y$F$K:o=|%U%i%0$rIU$1$^$9!#(B
$BDL>o!"JQ?t(B@code{dired-kept-versions}
$B!JJ]B8$9$k$H$-$KE,MQ$5$l$kJQ?t(B@code{kept-new-versions}$B$G$O(B@strong{$B$J$$(B}$B!K(B
$B$K$O?7$7$$HG$r2?8D;D$9$+$r;XDj$7!"(B
$BJQ?t(B@code{kept-old-versions}$B$K$O8E$$HG$r2?8D;D$9$+$r;XDj$7$^$9!#(B

@c   Period with a positive numeric argument, as in @kbd{C-u 3 .},
@c specifies the number of newest versions to keep, overriding
@c @code{dired-kept-versions}.  A negative numeric argument overrides
@c @code{kept-old-versions}, using minus the value of the argument to
@c specify the number of oldest versions of each file to keep.
@kbd{C-u 3 .}$B$N$h$&$K@5$N?t0z?t$r%T%j%*%I$K;XDj$9$k$H!"(B
$BJQ?t(B@code{dired-kept-versions}$B$rL5;k$7$F?7$7$$HG$r2?8D;D$9$+;XDj$7$^$9!#(B
$BIi$N?t0z?t$OJQ?t(B@code{kept-old-versions}$B$rL5;k$7$F(B
$B?t0z?t$N@dBPCM$G8E$$HG$r2?8D;D$9$+;XDj$7$^$9!#(B

@findex dired-flag-files-regexp
@c @kindex % d @r{(Dired)}
@kindex % d @r{$B!J(Bdired$B!K(B}
@c   The @kbd{% d} command flags all files whose names match a specified
@c regular expression (@code{dired-flag-files-regexp}).  Only the
@c non-directory part of the file name is used in matching.  You can use
@c @samp{^} and @samp{$} to anchor matches.  You can exclude subdirectories
@c by hiding them (@pxref{Hiding Subdirectories}).
@kbd{% d}$B%3%^%s%I$O!";XDj$7$?@55,I=8=!J(B@code{dired-flag-files-regexp}$B!K$K(B
$B0lCW$9$kL>A0$N%U%!%$%k$K:o=|%U%i%0$rIU$1$^$9!#(B
$B%U%!%$%kL>$N$&$A%G%#%l%/%H%j$KL54X78$JItJ,$K$D$$$F$@$10lCW$rD4$Y$^$9!#(B
@samp{^}$B!J@hF,!K$d(B@samp{$}$B!JKvHx!K$G!"0lCW2U=j$r8GDj$G$-$^$9!#(B
$B%5%V%G%#%l%/%H%j$r1#JC$9$l$P!"%5%V%G%#%l%/%H%j$r0lCW8!::$+$i=|30$G$-$^$9(B
$B!J(B@pxref{Hiding Subdirectories}$B!K!#(B

@node Dired Visiting
@c @section Visiting Files in Dired
@section dired$B$G$N%U%!%$%k$NK,Ld(B

@c   There are several Dired commands for visiting or examining the files
@c listed in the Dired buffer.  All of them apply to the current line's
@c file; if that file is really a directory, these commands invoke Dired on
@c that subdirectory (making a separate Dired buffer).
dired$B$K$O!"(Bdired$B%P%C%U%!$KI=<($7$?%U%!%$%k$rK,Ld$7$?$jD4$Y$?$j$9$k$?$a$N(B
$B%3%^%s%I$,$"$j$^$9!#(B
$B$3$l$i$O8=:_9T$N%U%!%$%k$K:nMQ$7$^$9!#(B
$B$=$N%U%!%$%k$,<B:]$K$O%G%#%l%/%H%j$G$"$k$H!"(B
$B$3$l$i$N%3%^%s%I$O$=$N%5%V%G%#%l%/%H%j$KBP$7$F(B
$B!JJL$N(Bdired$B%P%C%U%!$r:n$C$F!K(Bdired$B$r5/F0$7$^$9!#(B

@table @kbd
@item f
@c @kindex f @r{(Dired)}
@kindex f @r{$B!J(Bdired$B!K(B}
@findex dired-find-file
@c Visit the file described on the current line, like typing @kbd{C-x C-f}
@c and supplying that file name (@code{dired-find-file}).  @xref{Visiting}.
@kbd{C-x C-f}$B$HBG80$7$?$N$HF1MM$K!"(B
$B8=:_9T$,I=$9%U%!%$%k$rK,Ld$9$k!J(B@code{dired-find-file}$B!K(B
@pxref{Visiting}$B!#(B

@item @key{RET}
@c @kindex RET @r{(Dired)}
@kindex RET @r{$B!J(Bdired$B!K(B}
@c Equivalent to @kbd{f}.
@kbd{f}$B$HEy2A!#(B

@item o
@c @kindex o @r{(Dired)}
@kindex o @r{$B!J(Bdired$B!K(B}
@findex dired-find-file-other-window
@c Like @kbd{f}, but uses another window to display the file's buffer
@c (@code{dired-find-file-other-window}).  The Dired buffer remains visible
@c in the first window.  This is like using @kbd{C-x 4 C-f} to visit the
@c file.  @xref{Windows}.
@kbd{f}$B$HF1MM$@$,!"%U%!%$%k$N%P%C%U%!$rJL$N%&%#%s%I%&$KI=<($9$k(B
$B!J(B@code{dired-find-file-other-window}$B!K!#(B
dired$B%P%C%U%!$O:G=i$N%&%#%s%I%&$KI=<($5$l$?$^$^;D$k!#(B
$B$3$l$O(B@kbd{C-x 4 C-f}$B$G%U%!%$%k$rK,Ld$9$k$N$K;w$F$$$k!#(B
@pxref{Windows}$B!#(B

@item C-o
@c @kindex C-o @r{(Dired)}
@kindex C-o @r{$B!J(Bdired$B!K(B}
@findex dired-display-file
@c Visit the file described on the current line, and display the buffer in
@c another window, but do not select that window (@code{dired-display-file}).
$B8=:_9T$,I=$9%U%!%$%k$rK,Ld$7$FJL$N%&%#%s%I%&$KI=<($9$k$,!"(B
$B$=$N%&%#%s%I%&$rA*Br$7$J$$!J(B@code{dired-display-file}$B!K!#(B

@item Mouse-2
@findex dired-mouse-find-file-other-window
@c Visit the file named by the line you click on
@c (@code{dired-mouse-find-file-other-window}).  This uses another window
@c to display the file, like the @kbd{o} command.
$B%/%j%C%/$7$?9T$,I=$9%U%!%$%k$rK,Ld$9$k(B
$B!J(B@code{dired-mouse-find-file-other-window}$B!K!#(B
@kbd{o}$B%3%^%s%I$N$h$&$K!"(B
$B%U%!%$%k$NI=<($K$OJL$N%&%#%s%I%&$r;H$&!#(B

@item v
@c @kindex v @r{(Dired)}
@kindex v @r{$B!J(Bdired$B!K(B}
@findex dired-view-file
@c View the file described on the current line, using @kbd{M-x view-file}
@c (@code{dired-view-file}).
@kbd{M-x view-file}$B$rMQ$$$F8=:_9T$,I=$9%U%!%$%k$r1\Mw$9$k(B
$B!J(B@code{dired-view-file}$B!K!#(B

@c Viewing a file is like visiting it, but is slanted toward moving around
@c in the file conveniently and does not allow changing the file.
@c @xref{Misc File Ops,View File}.
$B%U%!%$%k$r1\Mw$9$k$3$H$O%U%!%$%k$rK,Ld$9$k$3$H$K;w$F$$$k$,!"(B
$B%U%!%$%k$NCf$G0\F0$G$-$k$3$H$K=E$-$rCV$-!"(B
$B%U%!%$%k$NJQ99$O5v$5$l$J$$!#(B
@pxref{Misc File Ops, View File}$B!#(B
@end table

@node Marks vs Flags
@c @section Dired Marks vs. Flags
@section dired$B$N0u$H%U%i%0(B

@c @cindex marking in Dired
@cindex dired$B$N0u(B
@cindex $B0u!J(Bdired$B!K(B
@c   Instead of flagging a file with @samp{D}, you can @dfn{mark} the file
@c with some other character (usually @samp{*}).  Most Dired commands to
@c operate on files, aside from ``expunge'' (@kbd{x}), look for files
@c marked with @samp{*}.
$B%U%!%$%k$K(B@samp{D}$B$G<($5$l$k:o=|%U%i%0$rIU$1$k$+$o$j$K(B
$BB>$NJ8;z!JDL>o(B@samp{*}$B!K$G<($5$l$k(B@dfn{$B0u(B}$B$rIU$1$k$3$H$b$G$-$^$9!#(B
$B!XKu>C!Y!J(B@kbd{x}$B!K0J30$N$[$H$s$I$N(Bdired$B%3%^%s%I$O!"(B
@samp{*}$B$G0uIU$1$7$?%U%!%$%k$r07$($^$9!#(B

@c   Here are some commands for marking with @samp{*}, or for unmarking or
@c operating on marks.  (@xref{Dired Deletion}, for commands to flag and
@c unflag files.)
$B0J2<$N%3%^%s%I$O!"(B@samp{*}$B$G0uIU$1$9$k%3%^%s%I!"(B
$B0u$r>C$9%3%^%s%I!"0u$K:nMQ$9$k%3%^%s%I$G$9!#(B
$B!J%U%i%0$rIU$1$?$j>C$7$?$j$9$k%3%^%s%I$K$D$$$F$O(B@pxref{Dired Deletion}$B!#!K(B

@table @kbd
@item m
@itemx * m
@c @kindex m @r{(Dired)}
@c @kindex * m @r{(Dired)}
@kindex m @r{$B!J(Bdired$B!K(B}
@kindex * m @r{$B!J(Bdired$B!K(B}
@findex dired-mark
@c Mark the current file with @samp{*} (@code{dired-mark}).  With a numeric
@c argument @var{n}, mark the next @var{n} files starting with the current
@c file.  (If @var{n} is negative, mark the previous @minus{}@var{n}
@c files.)
$B%+%l%s%H%U%!%$%k$K(B@samp{*}$B$G0u$rIU$1$k!J(B@code{dired-makr}$B!K!#(B
$B?t0z?t(B@var{n}$B$r;XDj$9$k$H!"%+%l%s%H%U%!%$%k$+$i;O$a$F8eB3$N(B
@var{n}$B8D$N%U%!%$%k$K0u$rIU$1$k!#(B
$B!J(B@var{n}$B$,Ii$N>l9g$O!">e$N(B@minus{}@var{n}$B8D$N%U%!%$%k$K0u$rIU$1$k!#!K(B

@item * *
@c @kindex * * @r{(Dired)}
@kindex * * @r{$B!J(Bdired$B!K(B}
@findex dired-mark-executables
@c Mark all executable files with @samp{*}
@c (@code{dired-mark-executables}).  With a numeric argument, unmark all
@c those files.
$B<B9T%U%!%$%k$9$Y$F$K(B@samp{*}$B$G0u$rIU$1$k(B
$B!J(B@code{dired-mark-executables}$B!K!#(B
$B?t0z?t$r;XDj$9$k$H!"$3$l$i$N%U%!%$%k$9$Y$F$N0u$r>C$9!#(B

@item * @@
@c @kindex * @@ @r{(Dired)}
@kindex * @@ @r{$B!J(Bdired$B!K(B}
@findex dired-mark-symlinks
@c Mark all symbolic links with @samp{*} (@code{dired-mark-symlinks}).
@c With a numeric argument, unmark all those files.
$B%7%s%\%j%C%/%j%s%/$9$Y$F$K(B@samp{*}$B$G0u$rIU$1$k(B
$B!J(B@code{dired-mark-symlinks}$B!K!#(B
$B?t0z?t$r;XDj$9$k$H!"$3$l$i$N%U%!%$%k$9$Y$F$N0u$r>C$9!#(B

@item * /
@c @kindex * / @r{(Dired)}
@kindex * / @r{$B!J(Bdired$B!K(B}
@findex dired-mark-directories
@c Mark with @samp{*} all files which are actually directories, except for
@c @file{.} and @file{..} (@code{dired-mark-directories}).  With a numeric
@c argument, unmark all those files.
@file{.}$B$H(B@file{..}$B$r=|$/$9$Y$F$N%G%#%l%/%H%j$K(B@samp{*}$B$G0u$rIU$1$k(B
$B!J(B@code{dired-mark-directories}$B!K!#(B
$B?t0z?t$r;XDj$9$k$H!"$3$l$i$N%G%#%l%/%H%j$9$Y$F$N0u$r>C$9!#(B

@item * s
@c @kindex * s @r{(Dired)}
@kindex * s @r{$B!J(Bdired$B!K(B}
@findex dired-mark-subdir-files
@c Mark all the files in the current subdirectory, aside from @file{.}
@c and @file{..} (@code{dired-mark-subdir-files}).
$B8=:_$N%5%V%G%#%l%/%H%jFb$N(B@file{.}$B$H(B@file{..}$B$r=|$/$9$Y$F$N%U%!%$%k$K(B
$B0u$rIU$1$k!J(B@code{dired-mark-subdir-files}$B!K!#(B

@item u
@itemx * u
@c @kindex u @r{(Dired)}
@c @kindex * u @r{(Dired)}
@kindex u @r{$B!J(Bdired$B!K(B}
@kindex * u @r{$B!J(Bdired$B!K(B}
@findex dired-unmark
@c Remove any mark on this line (@code{dired-unmark}).
$B$3$N9T$N0u$r>C$9!J(B@code{dired-unmark}$B!K!#(B

@item @key{DEL}
@itemx * @key{DEL}
@c @kindex * DEL @r{(Dired)}
@kindex * DEL @r{$B!J(Bdired$B!K(B}
@findex dired-unmark-backward
@c Move point to previous line and remove any mark on that line
@c (@code{dired-unmark-backward}).
$B%]%$%s%H$r$^$($N9T$XF0$+$7!"$=$N9T$N0u$r>C$9(B
$B!J(B@code{dired-unmark-backward}$B!K!#(B

@item * !
@c @kindex * ! @r{(Dired)}
@kindex * ! @r{$B!J(Bdired$B!K(B}
@findex dired-unmark-all-files-no-query
@c Remove all marks from all the files in this Dired buffer
@c (@code{dired-unmark-all-files-no-query}).
dired$B%P%C%U%!$N$9$Y$F$N%U%!%$%k$N0u$r>C$9(B
$B!J(B@code{dired-unmark-all-files-no-query}$B!K!#(B

@item * ? @var{markchar}
@c @kindex * ? @r{(Dired)}
@kindex * ? @r{$B!J(Bdired$B!K(B}
@findex dired-unmark-all-files
@c Remove all marks that use the character @var{markchar}
@c (@code{dired-unmark-all-files}).  The argument is a single
@c character---do not use @key{RET} to terminate it.
$B;XDj$7$?J8;z(B@var{markchar}$B$N0u$9$Y$F$r>C$9(B
$B!J(B@code{dired-unmark-all-files}$B!K!#(B
$B0z?t$O(B1$BJ8;z!#(B
@key{RET}$B$GF~NO$r=*$($F$O$J$i$J$$!#(B

@c With a numeric argument, this command queries about each marked file,
@c asking whether to remove its mark.  You can answer @kbd{y} meaning yes,
@c @kbd{n} meaning no, or @kbd{!} to remove the marks from the remaining
@c files without asking about them.
$B?t0z?t$r;XDj$9$k$H!"$3$N%3%^%s%I$O0u$NIU$$$?%U%!%$%k$4$H$K(B
$B0u$r>C$9$+$I$&$+J9$$$F$/$k!#(B
@kbd{y}$B$O>C$9$N0UL#!"(B@kbd{n}$B$O>C$5$J$$$N0UL#!#(B
@kbd{!}$B$GEz$($k$H;D$j$N%U%!%$%k$9$Y$F$K$D$$$FLd$$9g$o$;$:$K0u$r>C$9!#(B

@item * C-n
@findex dired-next-marked-file
@c @kindex * C-n @r{(Dired)}
@kindex * C-n @r{$B!J(Bdired$B!K(B}
@c Move down to the next marked file (@code{dired-next-marked-file})
@c A file is ``marked'' if it has any kind of mark.
$B0u$,IU$$$F$$$k$D$.$N%U%!%$%k$X?J$`(B
$B!J(B@code{dired-next-marked-file}$B!K!#(B
$B%U%!%$%k$K!X0u!Y$,IU$$$F$$$k$H$O!"$J$s$i$+$N0u$,$"$k$3$H!#(B

@item * C-p
@findex dired-prev-marked-file
@c @kindex * C-p @r{(Dired)}
@kindex * C-p @r{$B!J(Bdired$B!K(B}
@c Move up to the previous marked file (@code{dired-prev-marked-file})
$B0u$,IU$$$F$$$k$^$($N%U%!%$%k$XLa$k(B
$B!J(B@code{dired-prev-marked-file}$B!K(B

@item * t
@c @kindex * t @r{(Dired)}
@kindex * t @r{$B!J(Bdired$B!K(B}
@findex dired-do-toggle
@c Toggle all marks (@code{dired-do-toggle}): files marked with @samp{*}
@c become unmarked, and unmarked files are marked with @samp{*}.  Files
@c marked in any other way are not affected.
$B$9$Y$F$N0u$r@Z$jBX$($k!J(B@code{dired-do-toggle}$B!K!#(B
$B$D$^$j!"(B@samp{*}$B$G0u$,IU$$$F$$$k%U%!%$%k$N0u$r>C$7!"(B
$B0u$,IU$$$F$$$J$+$C$?%U%!%$%k$9$Y$F$K(B@samp{*}$B$G0u$rIU$1$k!#(B
@samp{*}$B0J30$G0u$,IU$$$?%U%!%$%k72$O1F6A$5$l$J$$!#(B

@item * c @var{old} @var{new}
@c @kindex * c @r{(Dired)}
@kindex * c @r{$B!J(Bdired$B!K(B}
@findex dired-change-marks
@c Replace all marks that use the character @var{old} with marks that use
@c the character @var{new} (@code{dired-change-marks}).  This command is
@c the primary way to create or use marks other than @samp{*} or @samp{D}.
@c The arguments are single characters---do not use @key{RET} to terminate
@c them.
$BJ8;z(B@var{old}$B$N0u$rJ8;z(B@var{new}$B$N0u$KCV$-49$($k(B
$B!J(B@code{dired-change-marks}$B!K!#(B
$B$3$N%3%^%s%I$O!"(B@samp{*}$B$d(B@samp{D}$B0J30$NJ8;z$G0u$rIU$1$k$?$a$N<gMW$J<jCJ!#(B
$B0z?t$O$=$l$>$l(B1$BJ8;z!#(B
@key{RET}$B$GF~NO$r=*$($F$O$J$i$J$$!#(B

@c You can use almost any character as a mark character by means of this
@c command, to distinguish various classes of files.  If @var{old} is a
@c space (@samp{ }), then the command operates on all unmarked files; if
@c @var{new} is a space, then the command unmarks the files it acts on.
$B$3$N%3%^%s%I$G$O$[$H$s$I$I$s$JJ8;z$G$b0u$H$7$F;H$($k$?$a!"(B
$B%U%!%$%k$r$$$m$$$m$KJ,N`$G$-$k!#(B
@var{old}$B$,6uGr!J(B@samp{ }$B!K$G$"$k$H!"(B
$B%3%^%s%I$O0u$,IU$$$F$$$J$$$9$Y$F$N%U%!%$%k$K:nMQ$9$k!#(B
@var{new}$B$,6uGr$G$"$k$H!"%3%^%s%I$O:nMQ$9$k%U%!%$%k$N0u$r>C$9!#(B

@c To illustrate the power of this command, here is how to put @samp{D}
@c flags on all the files that have no marks, while unflagging all those
@c that already have @samp{D} flags:
$B2<$NNc$O$3$N%3%^%s%I$NG=NO$rNc<($9$k$b$N$G$"$j!"(B
$B0u$N$J$$%U%!%$%k$9$Y$F$K(B@samp{D}$B%U%i%0$rIU$1!"(B
@samp{D}$B%U%i%0$,IU$$$F$$$k$b$N$9$Y$F$+$i$O%U%i%0$r>C$7$^$9!#(B

@example
* c D t  * c SPC D  * c t SPC
@end example

@c This assumes that no files are marked with @samp{t}.
$B$3$3$G$O!"(B@samp{t}$B$G0u$rIU$1$?%U%!%$%k$O$J$$$b$N$H2>Dj$7$^$9!#(B

@item % m @var{regexp} @key{RET}
@itemx * % @var{regexp} @key{RET}
@findex dired-mark-files-regexp
@c @kindex % m @r{(Dired)}
@c @kindex * % @r{(Dired)}
@kindex % m @r{$B!J(Bdired$B!K(B}
@kindex * % @r{$B!J(Bdired$B!K(B}
@c Mark (with @samp{*}) all files whose names match the regular expression
@c @var{regexp} (@code{dired-mark-files-regexp}).  This command is like
@c @kbd{% d}, except that it marks files with @samp{*} instead of flagging
@c with @samp{D}.  @xref{Flagging Many Files}.
$B@55,I=8=(B@var{regexp}$B$K0lCW$9$kL>A0$N%U%!%$%k$9$Y$F$K(B
$B!J(B@samp{*}$B$G!K0u$rIU$1$k!J(B@code{dired-mark-files-regexp}$B!K!#(B
$B$3$N%3%^%s%I$O(B@kbd{% d}$B$K;w$F$$$k$,!"(B
$B:o=|%U%i%0(B@samp{D}$B$N$+$o$j$K(B@samp{*}$B$G%U%!%$%k$K0u$rIU$1$k!#(B
@pxref{Flagging Many Files}$B!#(B

@c Only the non-directory part of the file name is used in matching.  Use
@c @samp{^} and @samp{$} to anchor matches.  Exclude subdirectories by
@c hiding them (@pxref{Hiding Subdirectories}).
$B%U%!%$%kL>$N$&$A%G%#%l%/%H%j$KL54X78$JItJ,$@$1$G0lCW$r8!::$9$k!#(B
@samp{^}$B!J@hF,!K$d(B@samp{$}$B!JKvHx!K$G!"0lCW2U=j$r8GDj$G$-$k!#(B
$B%5%V%G%#%l%/%H%j$r0lCW8!::$+$i=|30$9$k$K$O!"(B
$B%5%V%G%#%l%/%H%j$r1#JC$9$k!#(B

@item % g @var{regexp} @key{RET}
@findex dired-mark-files-containing-regexp
@c @kindex % m @r{(Dired)}
@kindex % m @r{$B!J(Bdired$B!K(B}
@c Mark (with @samp{*}) all files whose @emph{contents} contain a match for
@c the regular expression @var{regexp}
@c (@code{dired-mark-files-containing-regexp}).  This command is like
@c @kbd{% m}, except that it searches the file contents instead of the file
@c name.
$B%U%!%$%k$N(B@emph{$BFbMF(B}$B$,@55,I=8=(B@var{regexp}$B$K0lCW$9$k$9$Y$F$N%U%!%$%k$K(B
$B!J(B@samp{*}$B$G!K0u$rIU$1$k!J(B@code{dired-mark-files-containing-regexp}$B!K!#(B
$B$3$N%3%^%s%I$O(B@kbd{% m}$B$K;w$F$$$k$,!"(B
$B%U%!%$%kL>$G$O$J$/$=$NFbMF$GC5$9!#(B

@item C-_
@c @kindex C-_ @r{(Dired)}
@kindex C-_ @r{$B!J(Bdired$B!K(B}
@findex dired-undo
@c Undo changes in the Dired buffer, such as adding or removing
@c marks (@code{dired-undo}).
$B0u$NDI2C$d:o=|$J$I$N(Bdired$B%P%C%U%!$KBP$9$kJQ99$r%"%s%I%%$9$k(B
$B!J(B@code{dired-undo}$B!K(B
@end table

@node Operating on Files
@c @section Operating on Files
@section $B%U%!%$%k$NA`:n(B
@c @cindex operating on files in Dired
@cindex dired$B$G$N%U%!%$%k$NA`:n(B
@cindex $B%U%!%$%k$NA`:n!J(Bdired$B!K(B

@c   This section describes the basic Dired commands to operate on one file
@c or several files.  All of these commands are capital letters; all of
@c them use the minibuffer, either to read an argument or to ask for
@c confirmation, before they act.  All of them give you several ways to
@c specify which files to manipulate:
$BK\@a$G$O!"%U%!%$%k$rA`:n$9$k4pK\E*$J(Bdired$B%3%^%s%I$K$D$$$F@bL@$7$^$9!#(B
$B%3%^%s%I$O$9$Y$FBgJ8;z$G$"$j!"<B9TA0$K!"0z?t$rFI$_<h$C$?$j3NG'$r5a$a$k$?$a$K(B
$B%_%K%P%C%U%!$r;H$$$^$9!#(B
$B$3$l$i$9$Y$F$N%3%^%s%I$K$O!"(B
$BA`:nBP>]$H$J$k%U%!%$%k$r;XDj$9$kJ}K!$,$$$/$D$+$"$j$^$9!#(B

@itemize @bullet
@item
@c If you give the command a numeric prefix argument @var{n}, it operates
@c on the next @var{n} files, starting with the current file.  (If @var{n}
@c is negative, the command operates on the @minus{}@var{n} files preceding
@c the current line.)
$B%3%^%s%I$K?t0z?t(B@var{n}$B$rM?$($k$H!"(B
$B%+%l%s%H%U%!%$%k$+$i;O$a$F8eB3$N(B@var{n}$B8D$N%U%!%$%k$rA`:n$9$k!#(B
$B!J(B@var{n}$B$,Ii$N>l9g$K$O!"8=:_9T$+$i>e$N(B@minus{}@var{n}$B8D$N(B
$B%U%!%$%k$rA`:n$9$k!#!K(B

@item
@c Otherwise, if some files are marked with @samp{*}, the command operates
@c on all those files.
$B$5$b$J$1$l$P!"%U%!%$%k$K(B@samp{*}$B$G0u$,IU$$$F$$$l$P!"(B
$B%3%^%s%I$O0u$,IU$$$F$$$k$9$Y$F$N%U%!%$%k$rA`:n$9$k!#(B

@item
@c Otherwise, the command operates on the current file only.
$B$5$b$J$1$l$P!"%3%^%s%I$O%+%l%s%H%U%!%$%k$N$_$rA`:n$9$k!#(B
@end itemize

@c   Here are the file-manipulating commands that operate on files in this
@c way.  (Some other Dired commands, such as @kbd{!} and the @samp{%}
@c commands, also use these conventions to decide which files to work on.)
$B0J2<$O!">e$N$h$&$KA`:nBP>]$rA*$V%U%!%$%kA`:n%3%^%s%I$N0lMw$G$9!#(B
$B!J(B@kbd{!}$B$d(B@kbd{%}$B$J$I$NB>$N(Bdired$B%3%^%s%I$b!"(B
$BA`:nBP>]$H$9$k%U%!%$%k$r7hDj$9$k$N$K>e$NJ}K!$rMQ$$$k!#!K(B

@table @kbd
@findex dired-do-copy
@c @kindex C @r{(Dired)}
@kindex C @r{$B!J(Bdired$B!K(B}
@item C @var{new} @key{RET}
@c Copy the specified files (@code{dired-do-copy}).  The argument @var{new}
@c is the directory to copy into, or (if copying a single file) the new
@c name.
$B;XDj$7$?%U%!%$%k$r%3%T!<$9$k!J(B@code{dired-do-copy}$B!K!#(B
$B0z?t(B@var{new}$B$O%3%T!<@h$N%G%#%l%/%H%j$+!"(B
$B!J(B1$B$D$N%U%!%$%k$r%3%T!<$9$k>l9g$O!K?7$7$$L>A0!#(B

@vindex dired-copy-preserve-time
@c If @code{dired-copy-preserve-time} is non-@code{nil}, then copying with
@c this command sets the modification time of the new file to be the same
@c as that of the old file.
$BJQ?t(B@code{dired-copy-preserve-time}$B$,(B@code{nil}$B0J30$N>l9g$K$O!"(B
$B$3$N%3%^%s%I$G%3%T!<$7$?%U%!%$%k$N99?7;~4V$O$b$H$N%U%!%$%k$HF1$8$K$J$k!#(B

@item D
@findex dired-do-delete
@c @kindex D @r{(Dired)}
@kindex D @r{$B!J(Bdired$B!K(B}
@c Delete the specified files (@code{dired-do-delete}).  Like the other
@c commands in this section, this command operates on the @emph{marked}
@c files, or the next @var{n} files.  By contrast, @kbd{x}
@c (@code{dired-expunge}) deletes all @dfn{flagged} files.
$B;XDj$7$?%U%!%$%k$r:o=|$9$k!J(B@code{dired-do-delete}$B!K!#(B
$BK\@a$NB>$N%3%^%s%I$HF1MM$K!"$3$N%3%^%s%I$O(B@emph{$B0uIU$1(B}$B$5$l$?%U%!%$%k!"(B
$B$"$k$$$O!"8eB3$N(B@var{n}$B8D$N%U%!%$%k$K:nMQ$9$k!#(B
$BBP>HE*$K!"(B@kbd{x}$B!J(B@code{dired-expunge}$B!K$O!"(B
@dfn{$B%U%i%0(B}$B$,IU$$$?%U%!%$%k$r:o=|$9$k!#(B

@findex dired-do-rename
@c @kindex R @r{(Dired)}
@kindex R @r{$B!J(Bdired$B!K(B}
@item R @var{new} @key{RET}
@c Rename the specified files (@code{dired-do-rename}).  The argument
@c @var{new} is the directory to rename into, or (if renaming a single
@c file) the new name.
$B;XDj$7$?%U%!%$%k$NL>A0$rJQ99$9$k!J(B@code{dired-do-rename}$B!K!#(B
$B0z?t(B@var{new}$B$O0\F0@h$N%G%#%l%/%H%j$+!"(B
$B!J(B1$B$D$N%U%!%$%k$NL>A0$rJQ$($k>l9g$K$O!K?7$7$$L>A0!#(B

@c Dired automatically changes the visited file name of buffers associated
@c with renamed files so that they refer to the new names.
dired$B$O!"L>A0$rJQ99$7$?%U%!%$%k$KBP1~$9$k%P%C%U%!$NK,Ld@h$N(B
$B%U%!%$%kL>$r<+F0E*$KJQ99$9$k$N$G!"?7$7$$L>A0$,H?1G$5$l$k!#(B

@findex dired-do-hardlink
@c @kindex H @r{(Dired)}
@kindex H @r{$B!J(Bdired$B!K(B}
@item H @var{new} @key{RET}
@c Make hard links to the specified files (@code{dired-do-hardlink}).  The
@c argument @var{new} is the directory to make the links in, or (if making
@c just one link) the name to give the link.
$B;XDj$7$?%U%!%$%k$K%O!<%I%j%s%/$rD%$k!J(B@code{dired-do-hardlink}$B!K!#(B
$B0z?t(B@var{new}$B$O%j%s%/$rCV$/%G%#%l%/%H%j$+!"(B
$B!J(B1$B$D$N%j%s%/$rD%$k>l9g$K$O!K%j%s%/$KM?$($kL>A0!#(B

@findex dired-do-symlink
@c @kindex S @r{(Dired)}
@kindex S @r{$B!J(Bdired$B!K(B}
@item S @var{new} @key{RET}
@c Make symbolic links to the specified files (@code{dired-do-symlink}).
@c The argument @var{new} is the directory to make the links in, or (if
@c making just one link) the name to give the link.
$B;XDj$7$?%U%!%$%k$K%7%s%\%j%C%/%j%s%/$rD%$k!J(B@code{dired-do-symlink}$B!K!#(B
$B0z?t(B@var{new}$B$O%j%s%/$rCV$/%G%#%l%/%H%j$+!"(B
$B!J(B1$B$D$N%j%s%/$rD%$k>l9g$K$O!K%j%s%/$KM?$($kL>A0!#(B

@findex dired-do-chmod
@c @kindex M @r{(Dired)}
@kindex M @r{$B!J(Bdired$B!K(B}
@item M @var{modespec} @key{RET}
@c Change the mode (also called ``permission bits'') of the specified files
@c (@code{dired-do-chmod}).  This uses the @code{chmod} program, so
@c @var{modespec} can be any argument that @code{chmod} can handle.
$B;XDj$7$?%U%!%$%k$N%b!<%I!J$$$o$f$k%Q!<%_%C%7%g%s%S%C%H!K$rJQ99$9$k(B
$B!J(B@code{dired-do-chmod}$B!K!#(B
$B$3$N%3%^%s%I$O(B@code{chmod}$B%W%m%0%i%`$r;H$&$N$G!"(B
@var{modspec}$B$K$O(B@code{chmod}$B$,07$($kG$0U$N0z?t$r;XDj$G$-$k!#(B

@findex dired-do-chgrp
@c @kindex G @r{(Dired)}
@kindex G @r{$B!J(Bdired$B!K(B}
@item G @var{newgroup} @key{RET}
@c Change the group of the specified files to @var{newgroup}
@c (@code{dired-do-chgrp}).
$B;XDj$7$?%U%!%$%k$N%0%k!<%W$r(B@var{newgroup}$B$KJQ99$9$k(B
$B!J(B@code{dired-do-chgrp}$B!K!#(B

@findex dired-do-chown
@c @kindex O @r{(Dired)}
@kindex O @r{$B!J(Bdired$B!K(B}
@item O @var{newowner} @key{RET}
@c Change the owner of the specified files to @var{newowner}
@c (@code{dired-do-chown}).  (On most systems, only the superuser can do
@c this.)
$B;XDj$7$?%U%!%$%k$N=jM-<T$r(B@var{newowner}$B$KJQ99$9$k(B
$B!J(B@code{dired-do-chown}$B!K!#(B
$B!J$[$H$s$I$N%7%9%F%`$G$O!"%9!<%Q!<%f!<%6!<$@$1$,$3$l$r<B9T$G$-$k!#!K(B

@vindex dired-chown-program
@c The variable @code{dired-chown-program} specifies the name of the
@c program to use to do the work (different systems put @code{chown} in
@c different places).
$BJQ?t(B@code{dired-chown-program}$B$G!"(B
$B<B:]$NA`:n$r9T$&$?$a$K;HMQ$9$k%W%m%0%i%`$NL>A0$r;XDj$9$k!#(B
$B!J%7%9%F%`$K$h$C$F$O!"(B@code{chown}$B$rCV$/>l=j$,0[$J$k!#!K(B

@findex dired-do-print
@c @kindex P @r{(Dired)}
@kindex P @r{$B!J(Bdired$B!K(B}
@item P @var{command} @key{RET}
@c Print the specified files (@code{dired-do-print}).  You must specify the
@c command to print them with, but the minibuffer starts out with a
@c suitable guess made using the variables @code{lpr-command} and
@c @code{lpr-switches} (the same variables that @code{lpr-buffer} uses;
@c @pxref{Hardcopy}).
$B;XDj$7$?%U%!%$%k$r0u:~$9$k!J(B@code{dired-do-print}$B!K!#(B
$B%U%!%$%k$r0u:~$9$k%3%^%s%I$r;XDj$9$kI,MW$,$"$k$,!"(B
$B!J(B@code{lpr-buffer}$B$,;H$&$N$HF1$8!K(B
$BJQ?t(B@code{lpr-command}$B$H(B@code{lpr-switches}$B$H$+$i?dDj$7$?(B
$BE,@Z$J$b$N$,%_%K%P%C%U%!$K<($5$l$k!#(B

@findex dired-do-compress
@c @kindex Z @r{(Dired)}
@kindex Z @r{$B!J(Bdired$B!K(B}
@item Z
@c Compress the specified files (@code{dired-do-compress}).  If the file
@c appears to be a compressed file already, it is uncompressed instead.
$B;XDj$7$?%U%!%$%k$r05=L$9$k!J(B@code{dired-do-compress}$B!K!#(B
$B%U%!%$%k$,$9$G$K05=L:Q$_$H;W$o$l$k$H$-$OE83+$9$k!#(B

@findex dired-do-load
@c @kindex L @r{(Dired)}
@kindex L @r{$B!J(Bdired$B!K(B}
@item L
@c Load the specified Emacs Lisp files (@code{dired-do-load}).
@c @xref{Lisp Libraries}.
$B;XDj$7$?(BEmacs Lisp$B$N%U%!%$%k$r%m!<%I$9$k!J(B@code{dired-do-load}$B!K!#(B
@pxref{Lisp Libraries}$B!#(B

@findex dired-do-byte-compile
@c @kindex B @r{(Dired)}
@kindex B @r{$B!J(Bdired$B!K(B}
@item B
@c Byte compile the specified Emacs Lisp files
@c (@code{dired-do-byte-compile}).  @xref{Byte Compilation,, Byte
@c Compilation, elisp, The Emacs Lisp Reference Manual}.
$B;XDj$7$?(BEmacs Lisp$B$N%U%!%$%k$r%P%$%H%3%s%Q%$%k$9$k(B
$B!J(B@code{dired-do-byte-compile}$B!K!#(B
@pxref{Byte Compilation,, Byte Compilation, elisp, The Emacs Lisp Reference Manual}$B!#(B

@c @kindex A @r{(Dired)}
@kindex A @r{$B!J(Bdired$B!K(B}
@findex dired-do-search
@item A @var{regexp} @key{RET}
@c Search all the specified files for the regular expression @var{regexp}
@c (@code{dired-do-search}).
$B;XDj$7$?%U%!%$%k72$KBP$7$F@55,I=8=(B@var{regexp}$B$K0lCW$9$k$b$N$rC5$9(B
$B!J(B@code{dired-do-search}$B!K!#(B

@c This command is a variant of @code{tags-search}.  The search stops at
@c the first match it finds; use @kbd{M-,} to resume the search and find
@c the next match.  @xref{Tags Search}.
$B$3$N%3%^%s%I$O(B@code{tags-search}$B$NJQ7A!#(B
$B:G=i$K$_$D$+$C$?$H$3$m$GC5:w$O=*$k!#(B
$BC5:w$r:F3+$7$F$D$.$K0lCW$9$k$b$N$rC5$9$K$O!"(B@kbd{M-,}$B$r;H$&!#(B
@pxref{Tags Search}$B!#(B

@c @kindex Q @r{(Dired)}
@kindex Q @r{$B!J(Bdired$B!K(B}
@findex dired-do-query-replace
@item Q @var{from} @key{RET} @var{to} @key{RET}
@c Perform @code{query-replace-regexp} on each of the specified files,
@c replacing matches for @var{from} (a regular expression) with the string
@c @var{to} (@code{dired-do-query-replace}).
$B;XDj$7$?%U%!%$%k72$N$=$l$>$l$K$D$$$F!"(B
@code{query-replace-regexp}$B!JLd$$9g$o$;$J$,$i@55,I=8=$rCV49$9$k!K$r<B9T$7!"(B
@var{from}$B!J@55,I=8=!K$K0lCW$9$kItJ,$r(B@var{to}$B$KCV49$9$k(B
$B!J(B@code{dired-do-query-replace}$B!K!#(B

@c This command is a variant of @code{tags-query-replace}.  If you exit the
@c query replace loop, you can use @kbd{M-,} to resume the scan and replace
@c more matches.  @xref{Tags Search}.
$B$3$N%3%^%s%I$O(B@code{tags-search}$B$NJQ7A!#(B
$BCV49$N%k!<%W$rH4$1$?$"$H$K!"(B
$BC5:w$r:F3+$7$F$5$i$KCV49$r9T$&$K$O!"(B@kbd{M-,}$B$r;H$&!#(B
@pxref{Tags Search}$B!#(B
@end table

@c @kindex + @r{(Dired)}
@kindex + @r{$B!J(Bdired$B!K(B}
@findex dired-create-directory
@c   One special file-operation command is @kbd{+}
@c (@code{dired-create-directory}).  This command reads a directory name and
@c creates the directory if it does not already exist.
@kbd{+}$B$OFCJL$J%U%!%$%kA`:n%3%^%s%I$G$9!J(B@code{dired-create-directory}$B!K!#(B
$B$3$N%3%^%s%I$O!"%G%#%l%/%H%jL>$rFI$_<h$j!"(B
$B$=$l$,4{B8$G$J$1$l$P?7$?$K:n@.$7$^$9!#(B

@node Shell Commands in Dired
@c @section Shell Commands in Dired
@section dired$B$G$N%7%'%k%3%^%s%I(B
@c @cindex shell commands, Dired
@cindex $B%7%'%k%3%^%s%I!J(Bdired$B!K(B

@findex dired-do-shell-command
@c @kindex ! @r{(Dired)}
@kindex ! @r{$B!J(Bdired$B!K(B}
@c The dired command @kbd{!} (@code{dired-do-shell-command}) reads a shell
@c command string in the minibuffer and runs that shell command on all the
@c specified files.  You can specify the files to operate on in the usual
@c ways for Dired commands (@pxref{Operating on Files}).  There are two
@c ways of applying a shell command to multiple files:
dired$B%3%^%s%I$N(B@kbd{!}$B!J(B@code{dired-do-shell-command}$B!K$O!"(B
$B%_%K%P%C%U%!$+$i%7%'%k%3%^%s%I$rFI$_<h$j!"(B
$B;XDj$7$?%U%!%$%k$9$Y$F$K$D$$$F$=$N%7%'%k%3%^%s%I$r<B9T$7$^$9!#(B
dired$B%3%^%s%I$NIaDL$NJ}K!$GA`:nBP>]$N%U%!%$%k$r;XDj$G$-$^$9(B
$B!J(B@pxref{Operating on Files}$B!K!#(B
$BJ#?t%U%!%$%k$K%7%'%k%3%^%s%I$rE,MQ$9$kJ}K!$O(B2$BDL$j$"$j$^$9!#(B

@itemize @bullet
@item
@c If you use @samp{*} in the shell command, then it runs just once, with
@c the list of file names substituted for the @samp{*}.  The order of file
@c names is the order of appearance in the Dired buffer.
$B%7%'%k%3%^%s%ICf$K(B@samp{*}$B$r;H$&$H!"(B
$B;XDj$7$?%U%!%$%kL>$N%j%9%H$G(B@samp{*}$B$rCV$-49$($F%3%^%s%I$r0lEY$@$1<B9T$9$k!#(B
$B%j%9%HFb$G%U%!%$%k$,8=$l$k=gHV$O(Bdired$B%P%C%U%!$KI=<($5$l$F$$$k=g!#(B

@c Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire
@c list of file names, putting them into one tar file @file{foo.tar}.
$B$7$?$,$C$F!"(B@kbd{! tar cf foo.tar * @key{RET}}$B$O(B@code{tar}$B$r<B9T$7!"(B
$B;XDj$7$?0lO"$N%U%!%$%k$r(B@file{foo.tar}$B$H$$$&(Btar$B%U%!%$%k$K$^$H$a$k!#(B

@item
@c If the command string doesn't contain @samp{*}, then it runs once
@c @emph{for each file}, with the file name added at the end.
$B%3%^%s%IJ8;zNs$K(B@samp{*}$B$,4^$^$l$F$$$J$$>l9g$K$O!"(B
$B%3%^%s%IJ8;zNs$N:G8e$K$=$l$>$l$N%U%!%$%kL>$rIU$12C$($F(B
@emph{$B3F%U%!%$%k$4$H(B}$B$K%3%^%s%I$r(B1$B2s$:$D<B9T$9$k!#(B

@c For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each
@c file.
$B$?$H$($P!"(B@kbd{! uudecode @key{RET}}$B$O!"(B
$B3F%U%!%$%k$KBP$7$F(B@code{uudecode}$B%3%^%s%I$r<B9T$9$k!#(B
@end itemize

@c What if you want to run the shell command once for each file but with
@c the file name inserted in the middle?  Or if you want to use the file
@c names in a more complicated fashion?  Use a shell loop.  For example,
@c this shell command would run @code{uuencode} on each of the specified
@c files, writing the output into a corresponding @file{.uu} file:
$B3F%U%!%$%k$4$H$K%3%^%s%I$r(B1$B2s<B9T$7$?$$$,!"(B
$B%3%^%s%I$N:G8e$G$O$J$/ESCf$K%U%!%$%kL>$r;XDj$7$?$$>l9g$K$O$I$&$9$k$N$G$7$g$&!)(B@code{ }
$B$"$k$$$O!"$b$C$HJ#;($K%U%!%$%kL>$r;XDj$7$?$$>l9g$K$O$I$&$9$k$N$G$7$g$&!)(B@code{ }
$B$=$l$K$O%7%'%k$N%k!<%W$r;H$$$^$9!#(B
$B2<$NNc$G$O!";XDj$7$?3F%U%!%$%k$KBP$7$F(B@code{uuencode}$B$r<B9T$7$^$9$,!"(B
$B$=$N=PNO$OBP1~$9$k(B@file{.uu}$B$H$$$&%U%!%$%k$K3JG<$7$^$9!#(B

@example
for file in *; do uuencode $file $file >$file.uu; done
@end example

@c The working directory for the shell command is the top-level directory
@c of the Dired buffer.
$B%7%'%k%3%^%s%I$N:n6H%G%#%l%/%H%j$O!"(B
dired$B%P%C%U%!$N%H%C%W%G%#%l%/%H%j$G$9!#(B

@c The @kbd{!} command does not attempt to update the Dired buffer to show
@c new or modified files, because it doesn't really understand shell
@c commands, and does not know what files the shell command changed.  Use
@c the @kbd{g} command to update the Dired buffer (@pxref{Dired
@c Updating}).
@kbd{!}$B%3%^%s%I$O!"<B9T8e$K?7$?$K$G$-$?%U%!%$%k$dJQ99$5$l$?(B
$B%U%!%$%k$rI=<($9$k$?$a$K(Bdired$B%P%C%U%!$r99?7$9$k$3$H$O$7$^$;$s!#(B
$B$3$l$O%7%'%k%3%^%s%I$r<B:]$K$OM}2r$7$F$*$i$:!"(B
$B%7%'%k%3%^%s%I$,$I$N%U%!%$%k$rJQ99$9$k$N$+$o$+$i$J$$$+$i$G$9!#(B
dired$B%P%C%U%!$r99?7$9$k$K$O(B@kbd{g}$B%3%^%s%I$r;H$$$^$9(B
$B!J(B@pxref{Dired Updating}$B!K!#(B

@node Transforming File Names
@c @section Transforming File Names in Dired
@section dired$B$G$N%U%!%$%kL>$NJQ49(B

@c   Here are commands that alter file names in a systematic way:
$B$3$3$K$"$2$k%3%^%s%I$O%U%!%$%kL>$rAH?%E*$KJQ99$7$^$9!#(B

@table @kbd
@findex dired-upcase
@c @kindex % u @r{(Dired)}
@kindex % u @r{$B!J(Bdired$B!K(B}
@item % u
@c Rename each of the selected files to an upper-case name
@c (@code{dired-upcase}).  If the old file names are @file{Foo}
@c and @file{bar}, the new names are @file{FOO} and @file{BAR}.
$BA*Br$7$?%U%!%$%k$NL>A0$rBgJ8;z$KJQ$($k(B
$B!J(B@code{dired-upcase}$B!K!#(B
$B8E$$%U%!%$%kL>$,(B@file{Foo}$B$H(B@file{bar}$B$@$C$?>l9g!"(B
$B?7$7$$%U%!%$%kL>$O(B@file{FOO}$B$H(B@file{BAR}$B$K$J$k!#(B

@item % l
@findex dired-downcase
@c @kindex % l @r{(Dired)}
@kindex % l @r{$B!J(Bdired$B!K(B}
@c Rename each of the selected files to a lower-case name
@c (@code{dired-downcase}).  If the old file names are @file{Foo} and
@c @file{bar}, the new names are @file{foo} and @file{bar}.
$BA*Br$7$?%U%!%$%k$NL>A0$r>.J8;z$KJQ$($k(B
$B!J(B@code{dired-downcase}$B!K!#(B
$B8E$$%U%!%$%kL>$,(B@file{Foo}$B$H(B@file{bar}$B$@$C$?>l9g!"(B
$B?7$7$$%U%!%$%kL>$O(B@file{foo}$B$H(B@file{bar}$B$K$J$k!#(B

@item % R @var{from} @key{RET} @var{to} @key{RET}
@c @kindex % R @r{(Dired)}
@kindex % R @r{$B!J(Bdired$B!K(B}
@findex dired-do-rename-regexp
@itemx % C @var{from} @key{RET} @var{to} @key{RET}
@c @kindex % C @r{(Dired)}
@kindex % C @r{$B!J(Bdired$B!K(B}
@findex dired-do-copy-regexp
@itemx % H @var{from} @key{RET} @var{to} @key{RET}
@c @kindex % H @r{(Dired)}
@kindex % H @r{$B!J(Bdired$B!K(B}
@findex dired-do-hardlink-regexp
@itemx % S @var{from} @key{RET} @var{to} @key{RET}
@c @kindex % S @r{(Dired)}
@kindex % S @r{$B!J(Bdired$B!K(B}
@findex dired-do-symlink-regexp
@c These four commands rename, copy, make hard links and make soft links,
@c in each case computing the new name by regular-expression substitution
@c from the name of the old file.
$B$3$l$i$N(B4$B$D$N%3%^%s%I$O!"$=$l$>$l!"(B
$B%U%!%$%kL>$rJQ99$9$k!"%3%T!<$9$k!"%O!<%I%j%s%/$rD%$k!"(B
$B%7%s%\%j%C%/%j%s%/$rD%$k!#(B
$B$3$l$i$N%3%^%s%I$O!"$$$:$l$b!"(B
$B8E$$%U%!%$%kL>$+$i@55,I=8=$NCV49$G?7$7$$%U%!%$%kL>$r7hDj$9$k!#(B
@end table

@c   The four regular-expression substitution commands effectively perform
@c a search-and-replace on the selected file names in the Dired buffer.
@c They read two arguments: a regular expression @var{from}, and a
@c substitution pattern @var{to}.
$B@55,I=8=$NCV49$rMQ$$$k(B4$B$D$N%3%^%s%I$O!"<B<AE*$K$O!"(B
dired$B%P%C%U%!$K$*$$$F0lO"$NA*Br$7$?%U%!%$%k$NL>A0$r(B
$BC5:w$7$FCV49$r9T$$$^$9!#(B
$B$3$l$i$O0z?t$r(B2$B$DFI$_<h$j$^$9!#(B
$B@55,I=8=(B@var{from}$B$HCV49%Q%?!<%s(B@var{to}$B$G$9!#(B

@c   The commands match each ``old'' file name against the regular
@c expression @var{from}, and then replace the matching part with @var{to}.
@c You can use @samp{\&} and @samp{\@var{digit}} in @var{to} to refer to
@c all or part of what the pattern matched in the old file name, as in
@c @code{replace-regexp} (@pxref{Regexp Replace}).  If the regular expression
@c matches more than once in a file name, only the first match is replaced.
$B$3$l$i$N%3%^%s%I$O!"@55,I=8=(B@var{from}$B$K0lCW$9$k3F!X8E$$!Y%U%!%$%kL>$N(B
$B0lCW$7$?ItJ,$r(B@var{to}$B$GCV49$7$^$9!#(B
@code{replace-regexp}$B!J(B@pxref{Regexp Replace}$B!K$N$h$&$K!"(B
@var{to}$B$NCf$G$O(B@samp{\&}$B$d(B@samp{\@var{digit}}$B$rMQ$$$F(B
$B8E$$%U%!%$%kL>$K0lCW$7$?%Q%?!<%sA4BN$d$=$N0lIt$r;2>H$G$-$^$9!#(B
$B%U%!%$%kL>$N(B2$B2U=j0J>e$NItJ,$K@55,I=8=$,0lCW$9$k>l9g$K$O!"(B
$B:G=i$N0lCWItJ,$,CV49$5$l$^$9!#(B

@c   For example, @kbd{% R ^.*$ @key{RET} x-\& @key{RET}} renames each
@c selected file by prepending @samp{x-} to its name.  The inverse of this,
@c removing @samp{x-} from the front of each file name, is also possible:
@c one method is @kbd{% R ^x-\(.*\)$ @key{RET} \1 @key{RET}}; another is
@c @kbd{% R ^x- @key{RET} @key{RET}}.  (Use @samp{^} and @samp{$} to anchor
@c matches that should span the whole filename.)
$B$?$H$($P!"(B@kbd{% R ^.*$ @key{RET} x-\& @key{RET}}$B$O!"(B
$BA*Br$5$l$?%U%!%$%k$NL>A0$N@hF,$K(Bx-$B$rIU$12C$($k7A$G(B
$BL>A0$rJQ$($^$9!#(B
$B5U$K!"3F%U%!%$%k$NL>A0$N@hF,$N(B@samp{x-}$B$r<h$j5n$k$3$H$b$G$-$F!"(B
1$B$D$NJ}K!$O!"(B@kbd{% R ^x-\(.*\)$ @key{RET} \1 @key{RET}}$B$G$9!#(B
$B$"$k$$$O!"(B@kbd{% R ^x- @key{RET} @key{RET}}$B$G$b$G$-$^$9!#(B
$B!J%U%!%$%kL>A4BN$K0lCW$9$k$h$&$K$9$k$K$O(B@samp{^}$B$H(B@samp{$}$B$r;H$&!#!K(B

@c   Normally, the replacement process does not consider the files'
@c directory names; it operates on the file name within the directory.  If
@c you specify a numeric argument of zero, then replacement affects the
@c entire absolute file name including directory name.
$BDL>o!"CV49=hM}$G$O%U%!%$%kL>$N%G%#%l%/%H%jItJ,$O9MN8$7$^$;$s!#(B
$B%G%#%l%/%H%jFb$N%U%!%$%k$NL>A0$@$1$rA`:n$7$^$9!#(B
$B?t0z?t(B0$B$r;XDj$9$k$H!"CV49$O%G%#%l%/%H%jL>$r4^$s$@@dBP%U%!%$%kL>$K:nMQ$7$^$9!#(B

@c   Often you will want to select the set of files to operate on using the
@c same @var{regexp} that you will use to operate on them.  To do this,
@c mark those files with @kbd{% m @var{regexp} @key{RET}}, then use the
@c same regular expression in the command to operate on the files.  To make
@c this easier, the @kbd{%} commands to operate on files use the last
@c regular expression specified in any @kbd{%} command as a default.
$B0lO"$N%U%!%$%k$rA`:nBP>]$KA*$V$H$-$K!"(B
$B$=$l$i$rA`:n$9$k$H$-$K;H$&$N$HF1$8(B@var{regexp}$B!J@55,I=8=!K$r;H$$$?$$>l9g$,(B
$B$"$k$G$7$g$&!#(B
$B$3$l$r9T$&$K$O!"(B@kbd{% m @var{regexp} @key{RET}}$B$G$^$:0lO"$N%U%!%$%k$K(B
$B0u$rIU$1$F$+$i!"$=$l$i$rA`:n$9$k%3%^%s%I$K$bF1$8@55,I=8=$r;H$$$^$9!#(B
$B$3$l$r4JC1$K9T$($k$h$&$K!"(B
@kbd{%}$B$NIU$$$?%3%^%s%I$O!"(B@kbd{%}$BIU$-%3%^%s%I$$$:$l$+$K:G6a;XDj$7$?(B
$B@55,I=8=$r%G%U%)%k%H$G;H$$$^$9!#(B

@node Comparison in Dired
@c @section File Comparison with Dired
@section dired$B$G$N%U%!%$%k$NHf3S(B

@c   Here are two Dired commands that compare specified files using
@c @code{diff}.
dired$B$K$O!";XDj$7$?%U%!%$%k$r(B@code{diff}$B$GHf3S$9$k%3%^%s%I$,(B2$B$D$"$j$^$9!#(B

@table @kbd
@item =
@findex dired-diff
@c @kindex = @r{(Dired)}
@kindex = @r{$B!J(Bdired$B!K(B}
@c Compare the current file (the file at point) with another file (the file
@c at the mark) using the @code{diff} program (@code{dired-diff}).  The
@c file at the mark is the first argument of @code{diff}, and the file at
@c point is the second argument.
@code{diff}$B%W%m%0%i%`!J(B@code{dired-diff}$B!K$rMQ$$$F!"(B
$B!J%]%$%s%H$,$"$k2U=j$N!K%+%l%s%H%U%!%$%k$r(B
$B!J%^!<%/$,$"$k2U=j$N!KB>$N%U%!%$%k$HHf3S$9$k!#(B
$B%^!<%/$,$"$k2U=j$N%U%!%$%k$,(B@code{diff}$B$NBh(B1$B0z?t$G!"(B
$B%]%$%s%H$,$"$k2U=j$N%U%!%$%k$,Bh(B2$B0z?t$K$J$k!#(B

@findex dired-backup-diff
@c @kindex M-= @r{(Dired)}
@kindex M-= @r{$B!J(Bdired$B!K(B}
@item M-=
@c Compare the current file with its latest backup file
@c (@code{dired-backup-diff}).  If the current file is itself a backup,
@c compare it with the file it is a backup of; this way, you can compare
@c a file with any backup version of your choice.
$B%+%l%s%H%U%!%$%k$H$=$N:G?7$N%P%C%/%"%C%W%U%!%$%k$H$rHf3S$9$k(B
$B!J(B@code{dired-backup-diff}$B!K!#(B
$B%+%l%s%H%U%!%$%k$,%P%C%/%"%C%W%U%!%$%k$=$N$b$N$G$"$k$H$-$O!"(B
$B%P%C%/%"%C%W%U%!%$%k$N%P%C%/%"%C%W%U%!%$%k$H$NHf3S$r9T$&!#(B
$B$3$N$h$&$K$7$F!"G$0U$NHG$N%P%C%/%"%C%W%U%!%$%k$H$NHf3S$r9T$($k!#(B

@c The backup file is the first file given to @code{diff}.
$B%P%C%/%"%C%W%U%!%$%k$O(B@code{diff}$B$NBh(B1$B0z?t$K$J$k!#(B
@end table

@node Subdirectories in Dired
@c @section Subdirectories in Dired
@section dired$B$N%5%V%G%#%l%/%H%j(B
@c @cindex subdirectories in Dired
@c @cindex expanding subdirectories in Dired
@cindex dired$B$G$N%5%V%G%#%l%/%H%j(B
@cindex $B%5%V%G%#%l%/%H%j!J(Bdired$B!K(B
@cindex dired$B$G$N%5%V%G%#%l%/%H%j$NE83+(B

@c   A Dired buffer displays just one directory in the normal case;
@c but you can optionally include its subdirectories as well.
$BDL>o!"(Bdired$B%P%C%U%!$O(B1$B$D$N%G%#%l%/%H%j$@$1$rI=<($7$^$9!#(B
$B$7$+$7!"$=$N%5%V%G%#%l%/%H%j72$r0l=o$KI=<($5$;$k$3$H$b$G$-$^$9!#(B

@c   The simplest way to include multiple directories in one Dired buffer is
@c to specify the options @samp{-lR} for running @code{ls}.  (If you give a
@c numeric argument when you run Dired, then you can specify these options
@c in the minibuffer.)  That produces a recursive directory listing showing
@c all subdirectories at all levels.
1$B$D$N(Bdired$B%P%C%U%!Fb$KJ#?t$N%G%#%l%/%H%j$rI=<($5$;$k$b$C$H$b4JC1$JJ}K!$O!"(B
@code{ls}$B$r<B9T$9$k$H$-$K%*%W%7%g%s(B@samp{-lR}$B$r;XDj$9$k$3$H$G$9!#(B
$B!J(Bdired$B$r<B9T$9$k$H$-$K?t0z?t$r;XDj$9$k$H!"(B
$B$3$l$i$N%*%W%7%g%s$r%_%K%P%C%U%!$G;XDj$G$-$k!#!K(B
$B$3$l$K$h$j!"$9$Y$F$N%l%Y%k$N$9$Y$F$N%5%V%G%#%l%/%H%j$rI=<($7$?(B
$B:F5"E*$J%G%#%l%/%H%j0lMw$r:n$l$^$9!#(B

@c   But usually all the subdirectories are too many; usually you will
@c prefer to include specific subdirectories only.  You can do this with
@c the @kbd{i} command:
$B$7$+$7!"0lHL$K$O!"$9$Y$F$N%5%V%G%#%l%/%H%j$G$OB?$9$.$^$9!#(B
$BIaDL$O!"FCDj$N%5%V%G%#%l%/%H%j$@$1$r4^$a$?$$$G$7$g$&!#(B
$B$=$l$K$O!"(B@kbd{i}$B%3%^%s%I$r;H$$$^$9!#(B

@table @kbd
@findex dired-maybe-insert-subdir
@c @kindex i @r{(Dired)}
@kindex i @r{$B!J(Bdired$B!K(B}
@item i
@c @cindex inserted subdirectory (Dired)
@c @cindex in-situ subdirectory (Dired)
@cindex $B%5%V%G%#%l%/%H%j$NA^F~!J(Bdired$B!K(B
@cindex $BKd$a9~$s$@%5%V%G%#%l%/%H%j!J(Bdired$B!K(B
@c Insert the contents of a subdirectory later in the buffer.
$B;XDj$7$?%5%V%G%#%l%/%H%j$NFbMF$r%P%C%U%!$N=*$j$KDI2C$9$k!#(B
@end table

@c Use the @kbd{i} (@code{dired-maybe-insert-subdir}) command on a line
@c that describes a file which is a directory.  It inserts the contents of
@c that directory into the same Dired buffer, and moves there.  Inserted
@c subdirectory contents follow the top-level directory of the Dired
@c buffer, just as they do in @samp{ls -lR} output.
$B%G%#%l%/%H%j$G$"$k%U%!%$%k$rI=$99T$G!"(B
@kbd{i}$B!J(B@code{dired-maybe-insert-subdir}$B!K%3%^%s%I$r;H$$$^$9!#(B
$B;XDj$7$?%5%V%G%#%l%/%H%j$NFbMF$rF1$8(Bdired$B%P%C%U%!$KA^F~$7!"(B
$B$=$N2U=j$X0\F0$7$^$9!#(B
$BA^F~$5$l$?%5%V%G%#%l%/%H%j$NFbMF$O!"(B
@samp{ls -lR}$B$N=PNO$HF1MM$K!"(B
dired$B%P%C%U%!$N%H%C%W%l%Y%k$N%G%#%l%/%H%j$N$"$H$KB3$-$^$9!#(B

@c If the subdirectory's contents are already present in the buffer, the
@c @kbd{i} command just moves to it.
$B$9$G$K%5%V%G%#%l%/%H%j$NFbMF$,%P%C%U%!$K$"$k>l9g$K$O!"(B
@kbd{i}$B%3%^%s%I$O$=$NI=<(2U=j$K0\F0$9$k$@$1$G$9!#(B

@c In either case, @kbd{i} sets the Emacs mark before moving, so @kbd{C-u
@c C-@key{SPC}} takes you back to the old position in the buffer (the line
@c describing that subdirectory).
$B$I$A$i$N>l9g$K$*$$$F$b!"(B@kbd{i}$B$O0\F0$9$k$^$($K(BEmacs$B$N%^!<%/$r@_Dj$9$k$N$G!"(B
@kbd{C-u C-@key{SPC}}$B$G%P%C%U%!Fb$N$b$H$N2U=j(B
$B!J$=$N%5%V%G%#%l%/%H%j$rI=$99T!K$XLa$l$^$9!#(B

@c Use the @kbd{l} command (@code{dired-do-redisplay}) to update the
@c subdirectory's contents.  Use @kbd{k} to delete the subdirectory.
@c @xref{Dired Updating}.
$B%5%V%G%#%l%/%H%j$NFbMF$r99?7$9$k$K$O!"(B
@kbd{l}$B!J(B@code{dired-do-redisplay}$B!K%3%^%s%I$r;H$$$^$9!#(B
$B%5%V%G%#%l%/%H%j$r:o=|$9$k$K$O(B@kbd{k}$B$r;H$$$^$9!#(B
@xref{Dired Updating}$B!#(B

@node Subdirectory Motion
@c @section Moving Over Subdirectories
@section $B%5%V%G%#%l%/%H%j$X$N0\F0(B

@c   When a Dired buffer lists subdirectories, you can use the page motion
@c commands @kbd{C-x [} and @kbd{C-x ]} to move by entire directories.
dired$B%P%C%U%!$K%5%V%G%#%l%/%H%j$,I=<($5$l$F$$$k>l9g!"(B
$B%3%^%s%I(B@kbd{C-x [}$B$H(B@kbd{C-x ]}$B$G%G%#%l%/%H%jC10L$K0\F0$G$-$^$9!#(B

@c @cindex header line (Dired)
@c @cindex directory header lines
@cindex $B%X%C%@9T!J(Bdired$B!K(B
@cindex $B%G%#%l%/%H%j$N%X%C%@9T(B
@c   The following commands move across, up and down in the tree of
@c directories within one Dired buffer.  They move to @dfn{directory header
@c lines}, which are the lines that give a directory's name, at the
@c beginning of the directory's contents.
$B0J2<$N%3%^%s%I$O!"(B1$B$D$N(Bdired$B%P%C%U%!Fb$G(B
$B%G%#%l%/%H%jLZ9=B$$r>e2<$K0\F0$9$k%3%^%s%I$G$9!#(B
$B$3$l$i$O$9$Y$F(B@dfn{$B%G%#%l%/%H%j$N%X%C%@9T(B}
$B!J(Bdirectory header lines$B!K!"(B
$B$D$^$j!"%G%#%l%/%H%j$NFbMF$rI=<($9$kItJ,$N@hF,$K$"$k(B
$B%G%#%l%/%H%jL>$r<($99T$K0\F0$7$^$9!#(B

@table @kbd
@findex dired-next-subdir
@c @kindex C-M-n @r{(Dired)}
@kindex C-M-n @r{$B!J(Bdired$B!K(B}
@item C-M-n
@c Go to next subdirectory header line, regardless of level
@c (@code{dired-next-subdir}).
$B%l%Y%k$K4X78$J$/$D$.$N%5%V%G%#%l%/%H%j$N%X%C%@9T$X?J$`(B
$B!J(B@code{dired-next-subdir}$B!K!#(B

@findex dired-prev-subdir
@c @kindex C-M-p @r{(Dired)}
@kindex C-M-p @r{$B!J(Bdired$B!K(B}
@item C-M-p
@c Go to previous subdirectory header line, regardless of level
@c (@code{dired-prev-subdir}).
$B%l%Y%k$K4X78$J$/$^$($N%5%V%G%#%l%/%H%j$N%X%C%@9T$XLa$k(B
$B!J(B@code{dired-prev-subdir}$B!K!#(B

@findex dired-tree-up
@c @kindex C-M-u @r{(Dired)}
@kindex C-M-u @r{$B!J(Bdired$B!K(B}
@item C-M-u
@c Go up to the parent directory's header line (@code{dired-tree-up}).
$B?F%G%#%l%/%H%j$N%G%#%l%/%H%j%X%C%@9T$X0\F0$9$k!J(B@code{dired-tree-up}$B!K!#(B

@findex dired-tree-down
@c @kindex C-M-d @r{(Dired)}
@kindex C-M-d @r{$B!J(Bdired$B!K(B}
@item C-M-d
@c Go down in the directory tree, to the first subdirectory's header line
@c (@code{dired-tree-down}).
$B%G%#%l%/%H%jLZ9=B$$r(B1$B$D9_$j$F:G=i$N%5%V%G%#%l%/%H%j$N%X%C%@9T$X0\F0$9$k(B
$B!J(B@code{dired-tree-down}$B!K!#(B

@findex dired-prev-dirline
@c @kindex < @r{(Dired)}
@kindex < @r{$B!J(Bdired$B!K(B}
@item <
@c Move up to the previous directory-file line (@code{dired-prev-dirline}).
@c These lines are the ones that describe a directory as a file in its
@c parent directory.
$B$^$($N%G%#%l%/%H%j%U%!%$%k$NI=<(9T$XLa$k!J(B@code{dired-prev-dirline}$B!K!#(B
$B$3$l$i$N9T$O!"?F%G%#%l%/%H%j$K$*$$$F%U%!%$%k$H$7$F%G%#%l%/%H%j$rI=$99T!#(B

@findex dired-next-dirline
@c @kindex > @r{(Dired)}
@kindex > @r{$B!J(Bdired$B!K(B}
@item >
@c Move down to the next directory-file line (@code{dired-prev-dirline}).
$B$D$.$N%G%#%l%/%H%j%U%!%$%k$NI=<(9T$X?J$`!J(B@code{dired-next-dirline}$B!K!#(B
@end table

@node Hiding Subdirectories
@c @section Hiding Subdirectories
@section $B%5%V%G%#%l%/%H%j$N1#JC(B

@c @cindex hiding in Dired (Dired)
@cindex $B1#JC!J(Bdired$B!K(B
@c   @dfn{Hiding} a subdirectory means to make it invisible, except for its
@c header line, via selective display (@pxref{Selective Display}).
$B%5%V%G%#%l%/%H%j$N(B@dfn{$B1#JC(B}$B!J(Bhide$B!K$H$O!"(B
$BA*BrE*I=<(!J(B@pxref{Selective Display}$B!K$rMQ$$$F(B
$B%X%C%@9T0J30$r8+$($J$/$9$k$3$H$G$9!#(B

@table @kbd
@item $
@findex dired-hide-subdir
@c @kindex $ @r{(Dired)}
@kindex $ @r{$B!J(Bdired$B!K(B}
@c Hide or reveal the subdirectory that point is in, and move point to the
@c next subdirectory (@code{dired-hide-subdir}).  A numeric argument serves
@c as a repeat count.
$B%]%$%s%H0LCV$K$"$k%5%V%G%#%l%/%H%j$r1#JC!"$"$k$$$O!":FI=<($7$F!"(B
$B%]%$%s%H$r$D$.$N%5%V%G%#%l%/%H%j$X0\F0$9$k(B
$B!J(B@code{dired-hide-subdir}$B!K!#(B
$B?t0z?t$OH?I|2s?t!#(B

@item M-$
@findex dired-hide-all
@c @kindex M-$ @r{(Dired)}
@kindex M-$ @r{$B!J(Bdired$B!K(B}
@c Hide all subdirectories in this Dired buffer, leaving only their header
@c lines (@code{dired-hide-all}).  Or, if any subdirectory is currently
@c hidden, make all subdirectories visible again.  You can use this command
@c to get an overview in very deep directory trees or to move quickly to
@c subdirectories far away.
dired$B%P%C%U%!Cf$N$9$Y$F$N%5%V%G%#%l%/%H%j$r1#JC$7!"(B
$B%5%V%G%#%l%/%H%j$N%X%C%@9T$@$1$r;D$9!J(B@code{dired-hide-all}$B!K!#(B
$B$"$k$$$O!"1#JC$5$l$F$$$k%5%V%G%#%l%/%H%j$,$"$k>l9g$K$O!"(B
$B$9$Y$F$N%5%V%G%#%l%/%H%j$r:FI=<($9$k!#(B
$B$3$N%3%^%s%I$r;H$&$H!"(B
$B?<$$%G%#%l%/%H%jLZ9=B$$N357A$rD4$Y$?$j!"(B
$B1s$/N%$l$?%5%V%G%#%l%/%H%j$XAGAa$/0\F0$G$-$k!#(B
@end table

@c   Ordinary Dired commands never consider files inside a hidden
@c subdirectory.  For example, the commands to operate on marked files
@c ignore files in hidden directories even if they are marked.  Thus you
@c can use hiding to temporarily exclude subdirectories from operations
@c without having to remove the markers.
$BDL>o$N(Bdired$B%3%^%s%I$O!"(B
$B1#JC$5$l$?%5%V%G%#%l%/%H%jFb$N%U%!%$%k$K$D$$$F$^$C$?$/9MN8$7$^$;$s!#(B
$B$?$H$($P!"0u$rIU$1$?%U%!%$%k$K:nMQ$9$k%3%^%s%I$O!"(B
$B1#JC$5$l$?%G%#%l%/%H%jFb$K0u$rIU$1$?%U%!%$%k$,(B
$B$"$C$?$H$7$F$b$=$l$i$rL5;k$7$^$9!#(B
$B$7$?$,$C$F!"%5%V%G%#%l%/%H%j$r0l;~E*$K1#JC$9$l$P!"(B
$B0u$r>C$5$J$/$F$b%5%V%G%#%l%/%H%j$rA`:nBP>]$+$i30$;$^$9!#(B

@c   The subdirectory hiding commands toggle; that is, they hide what was
@c visible, and show what was hidden.
$B%5%V%G%#%l%/%H%j$r1#JC$9$k%3%^%s%I$O%H%0%k$H$7$FF/$-$^$9!#(B
$B$D$^$j!"I=<($5$l$F$$$l$P1#JC$7!"1#JC$5$l$F$$$l$PI=<($7$^$9!#(B

@node Dired Updating
@c @section Updating the Dired Buffer
@section dired$B%P%C%U%!$N99?7(B

@c   This section describes commands to update the Dired buffer to reflect
@c outside (non-Dired) changes in the directories and files, and to delete
@c part of the Dired buffer.
$BK\@a$G$O!"!J(Bdired$B$H$OL54X78$K!K30It$G$N%G%#%l%/%H%j$d%U%!%$%k$NJQ99$r(B
dired$B%P%C%U%!$KH?1G$5$;$k%3%^%s%I!"$*$h$S!"(B
dired$B%P%C%U%!$N0lIt$r:o=|$9$k%3%^%s%I$r@bL@$7$^$9!#(B

@table @kbd
@item g
@c Update the entire contents of the Dired buffer (@code{revert-buffer}).
dired$B%P%C%U%!$NA4FbMF$r99?7$9$k!J(B@code{revert-buffer}$B!K!#(B

@item l
@c Update the specified files (@code{dired-do-redisplay}).
$B;XDj$7$?%U%!%$%k$r99?7$9$k!J(B@code{dired-do-redisplay}$B!K!#(B

@item k
@c Delete the specified @emph{file lines}---not the files, just the lines
@c (@code{dired-do-kill-lines}).
$B;XDj$7$?%U%!%$%k$N(B@emph{$BI=<(9T(B}$B$r:o=|$9$k!#(B
$B%U%!%$%k$G$O$J$/!"C1$KI=<(9T$@$1$r>C$9!J(B@code{dired-do-kill-lines}$B!K!#(B

@item s
@c Toggle between alphabetical order and date/time order
@c (@code{dired-sort-toggle-or-edit}).
$B%"%k%U%!%Y%C%H=g$NI=<($HF|IU!?;~4V=g$NI=<($r@Z$jBX$($k(B
$B!J(B@code{dired-sort-toggle-or-edit}$B!K!#(B

@item C-u s @var{switches} @key{RET}
@c Refresh the Dired buffer using @var{switches} as
@c @code{dired-listing-switches}.
$B%*%W%7%g%s(B@var{switches}$B$r(B@code{dired-listing-switches}$B$H$7$FMQ$$$F(B
dired$B%P%C%U%!$r99?7$9$k!#(B
@end table

@c @kindex g @r{(Dired)}
@kindex g @r{$B!J(Bdired$B!K(B}
@c @findex revert-buffer @r{(Dired)}
@findex revert-buffer @r{$B!J(Bdired$B!K(B}
@c   Type @kbd{g} (@code{revert-buffer}) to update the contents of the
@c Dired buffer, based on changes in the files and directories listed.
@c This preserves all marks except for those on files that have vanished.
@c Hidden subdirectories are updated but remain hidden.
@kbd{g}$B!J(B@code{revert-buffer}$B!K%3%^%s%I$r<B9T$9$k$H!"(B
$BI=<($5$l$F$$$k%U%!%$%k$d%G%#%l%/%H%j$NJQ99$K4p$E$$$F(Bdired$B%P%C%U%!$r(B
$B99?7$7$^$9!#(B
$B$3$N%3%^%s%I$O>C$5$l$?%U%!%$%k$KBP$9$k$b$N$r=|$$$F(B
$B$9$Y$F$N0u$d%U%i%0$rJ]B8$7$^$9!#(B
$B1#JC$5$l$?%5%V%G%#%l%/%H%j$b99?7$5$l$^$9$,!"1#JC$5$l$?$^$^$G$9!#(B

@c @kindex l @r{(Dired)}
@kindex l @r{$B!J(Bdired$B!K(B}
@findex dired-do-redisplay
@c   To update only some of the files, type @kbd{l}
@c (@code{dired-do-redisplay}).  This command applies to the next @var{n}
@c files, or to the marked files if any, or to the current file.  Updating
@c them means reading their current status from the file system and
@c changing the buffer to reflect it properly.
$B$$$/$D$+$N%U%!%$%k$@$1$r99?7$9$k>l9g$K$O!"(B
@kbd{l}$B!J(B@code{dired-do-redisplay}$B!K$HBG$A$^$9!#(B
$B$3$N%3%^%s%I$O!"8eB3$N(B@var{n}$B8D$N%U%!%$%k!"(B
$B0u$rIU$1$?%U%!%$%k$,$"$l$P$=$l$i$N%U%!%$%k!"(B
$B%+%l%s%H%U%!%$%k$N$$$:$l$+$K:nMQ$7$^$9!#(B
$B$=$l$i$r99?7$9$k$H$O!"$=$l$i$N%U%!%$%k$N8=>u$r%U%!%$%k%7%9%F%`$+$i<hF@$7!"(B
$B$=$l$r@5$7$/H?1G$9$k$h$&$K%P%C%U%!$r99?7$7$^$9!#(B

@c   If you use @kbd{l} on a subdirectory header line, it updates the
@c contents of the corresponding subdirectory.
@kbd{l}$B$r%5%V%G%#%l%/%H%j$N%X%C%@9T$G<B9T$9$k$H!"(B
$BBP1~$9$k%5%V%G%#%l%/%H%j$NFbMF$r99?7$7$^$9!#(B

@c @kindex k @r{(Dired)}
@kindex k @r{$B!J(Bdired$B!K(B}
@findex dired-do-kill-lines
@c   To delete the specified @emph{file lines}---not the files, just the
@c lines---type @kbd{k} (@code{dired-do-kill-lines}).  With a numeric
@c argument @var{n}, this command applies to the next @var{n} files;
@c otherwise, it applies to the marked files.
$B;XDj$7$?(B@emph{$B%U%!%$%k$NI=<(9T(B}$B$r:o=|$9$k!"(B
$B$D$^$j!"%U%!%$%k$=$N$b$N$G$O$J$/9T$@$1$r:o=|$9$k$K$O(B
@kbd{k}$B!J(B@code{dired-do-kill-lines}$B!K$HBG$A$^$9!#(B
$B?t0z?t(B@var{n}$B$r;XDj$9$k$H!"(B
$B$3$N%3%^%s%I$O!"8eB3$N(B@var{n}$B8D$N%U%!%$%k$K:nMQ$7$^$9!#(B
$B$5$b$J$1$l$P!"0u$rIU$1$?%U%!%$%k$K:nMQ$7$^$9!#(B

@c   If you kill the line for a file that is a directory, the directory's
@c contents are also deleted from the buffer.  Typing @kbd{C-u k} on the
@c header line for a subdirectory is another way to delete a subdirectory
@c from the Dired buffer.
$B:o=|$9$k%U%!%$%k$NI=<(9T$,%G%#%l%/%H%j$@$C$?>l9g$K$O!"(B
$B$=$N%G%#%l%/%H%j$NFbMF$b%P%C%U%!$+$i:o=|$5$l$^$9!#(B
$B%5%V%G%#%l%/%H%j$N%X%C%@9T$G(B@kbd{C-u k}$B$HBG$C$F$b!"(B
dired$B%P%C%U%!$+$i%5%V%G%#%l%/%H%j$NFbMF$r:o=|$G$-$^$9!#(B

@c   The @kbd{g} command brings back any individual lines that you have
@c killed in this way, but not subdirectories---you must use @kbd{i} to
@c reinsert each subdirectory.
@kbd{g}$B%3%^%s%I$O!"$3$N$h$&$K$7$F:o=|$7$?I=<(9T$r2hLL$K8F$SLa$9$3$H$,(B
$B$G$-$^$9$,!"%5%V%G%#%l%/%H%j$K4X$7$F$O$G$-$^$;$s!#(B
$B3F%5%V%G%#%l%/%H%j$r:FEYA^F~$9$k$K$O(B@kbd{i}$B$r;H$&I,MW$,$"$j$^$9!#(B

@c @cindex Dired sorting
@c @cindex sorting Dired buffer
@cindex dired$B$G$N%=!<%H(B
@cindex dired$B%P%C%U%!$N%=!<%H(B
@cindex $B%=!<%H!J(Bdired$B%P%C%U%!!K(B
@c @kindex s @r{(Dired)}
@kindex s @r{$B!J(Bdired$B!K(B}
@findex dired-sort-toggle-or-edit
@c   The files in a Dired buffers are normally listed in alphabetical order
@c by file names.  Alternatively Dired can sort them by date/time.  The
@c Dired command @kbd{s} (@code{dired-sort-toggle-or-edit}) switches
@c between these two sorting modes.  The mode line in a Dired buffer
@c indicates which way it is currently sorted---by name, or by date.
dired$B%P%C%U%!Fb$N%U%!%$%k$O!"DL>o!"(B
$B%U%!%$%kL>$N%"%k%U%!%Y%C%H=g$KJB$s$G$$$^$9!#(B
dired$B$OF|IU!?;~4V=g$KJB$YBX$($k$3$H$b$G$-$^$9!#(B
dired$B%3%^%s%I(B@kbd{s}$B!J(B@code{dired-sort-toggle-or-edit}$B!K$O!"(B
$B$3$l$i(B2$B$D$N%=!<%HJ}K!$r@Z$jBX$($^$9!#(B
dired$B%P%C%U%!$N%b!<%I9T$K$O!"%"%k%U%!%Y%C%H=g$HF|IU!?;~4V=g$N(B
$B$I$A$i$G8=:_I=<($7$F$$$k$+$,<($5$l$^$9!#(B

@c   @kbd{C-u s @var{switches} @key{RET}} lets you specify a new value for
@c @code{dired-listing-switches}.
@kbd{C-u s @var{switches} @key{RET}}$B$G!"(B
$BJQ?t(B@code{dired-listing-switches}$B$K?7$7$$CM$r@_Dj$G$-$^$9!#(B

@node Dired and Find
@c @section Dired and @code{find}
@section dired$B$H(B@code{find}$B%W%m%0%i%`(B
@c @cindex @code{find} and Dired
@cindex @code{find}$B$H(Bdired

@c   You can select a set of files for display in a Dired buffer more
@c flexibly by using the @code{find} utility to choose the files.
@code{find}$B%W%m%0%i%`$r;H$C$F%U%!%$%k$rA*$Y$P!"(B
dired$B%P%C%U%!>e$KI=<($9$k0lO"$N%U%!%$%k$r$b$C$H=@Fp$KA*Br$G$-$^$9!#(B

@findex find-name-dired
@c   To search for files with names matching a wildcard pattern use
@c @kbd{M-x find-name-dired}.  It reads arguments @var{directory} and
@c @var{pattern}, and chooses all the files in @var{directory} or its
@c subdirectories whose individual names match @var{pattern}.
$B%o%$%k%I%+!<%I$K0lCW$9$kL>A0$N%U%!%$%k$rC5:w$9$k$K$O(B
@kbd{M-x find-name-dired}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"(B2$B$D$N0z?t(B@var{directory}$B$H(B@var{pattern}$B$rFI$_<h$j!"(B
@var{directory}$B$K$"$k$9$Y$F$N%U%!%$%k!"(B
$B$"$k$$$O!"$=$N%5%V%G%#%l%/%H%j2<$K$"$k(B@var{pattern}$B$K0lCW$9$kL>A0$N%U%!%$%k$r(B
$BA*Br$7$^$9!#(B

@c   The files thus chosen are displayed in a Dired buffer in which the
@c ordinary Dired commands are available.
$B$3$N$h$&$K$7$FA*Br$5$l$?%U%!%$%k$O(Bdired$B%P%C%U%!$KI=<($5$l!"(B
$B$3$N%P%C%U%!$G$O$b$H$N(Bdired$B%3%^%s%I$r;H$($^$9!#(B

@findex find-grep-dired
@c   If you want to test the contents of files, rather than their names,
@c use @kbd{M-x find-grep-dired}.  This command reads two minibuffer
@c arguments, @var{directory} and @var{regexp}; it chooses all the files in
@c @var{directory} or its subdirectories that contain a match for
@c @var{regexp}.  It works by running the programs @code{find} and
@c @code{grep}.  See also @kbd{M-x grep-find}, in @ref{Compilation}.
@c Remember to write the regular expression for @code{grep}, not for Emacs.
$B%U%!%$%kL>$G$O$J$/%U%!%$%k$NFbMF$GD4$Y$?$$>l9g$K$O!"(B
@kbd{M-x find-grep-dired}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O%_%K%P%C%U%!$+$i(B2$B$D$N0z?t(B@var{directory}$B$H(B@var{regexp}$B$r(B
$BFI$_<h$j$^$9!#(B
@var{directory}$B$K$"$k$9$Y$F$N%U%!%$%k!"(B
$B$"$k$$$O!"(B@var{regexp}$B$K0lCW$9$k$b$N$r4^$`0lO"$N%5%V%G%#%l%/%H%j$rA*Br$7$^$9!#(B
$B$3$N%3%^%s%I$O!"%W%m%0%i%`(B@code{find}$B$H(B@code{grep}$B$r<B9T$7$FF0:n$7$^$9!#(B
@ref{Compilation}$B$N(B@kbd{M-x grep-find}$B$b;2>H$7$F$/$@$5$$!#(B
Emacs$B$N@55,I=8=$G$O$J$/(B@code{grep}$B$N@55,I=8=$r=q$/$3$H$rK:$l$J$$$G$/$@$5$$!#(B

@findex find-dired
@c   The most general command in this series is @kbd{M-x find-dired}, which
@c lets you specify any condition that @code{find} can test.  It takes two
@c minibuffer arguments, @var{directory} and @var{find-args}; it runs
@c @code{find} in @var{directory}, passing @var{find-args} to tell
@c @code{find} what condition to test.  To use this command, you need to
@c know how to use @code{find}.
$B$3$N$h$&$J0lO"$N%3%^%s%I$NCf$G$b$C$H$b0lHLE*$J%3%^%s%I$O(B@kbd{M-x find-dired}$B$G!"(B
@code{find}$B$,8!::$KMQ$$$kG$0U$N>r7o$r;XDj$G$-$^$9!#(B
$B$3$N%3%^%s%I$O%_%K%P%C%U%!$+$i(B2$B$D$N0z?t(B@var{directory}$B$H(B@var{find-args}$B$r(B
$BFI$_<h$j$^$9!#(B
$B8!::$9$Y$->r7o$r;X<($9$k(B@var{find-args}$B$rEO$7$F!"(B
@var{directory}$B$K$*$$$F(B@code{find}$B$r<B9T$7$^$9!#(B
$B$3$N%3%^%s%I$r;H$&$K$O!"(B@code{find}$B$N;H$$J}$rCN$C$F$$$kI,MW$,$"$j$^$9!#(B

@vindex find-ls-option
@c   The format of listing produced by these commands is controlled by the
@c variable @code{find-ls-option}, whose default value specifies using
@c options @samp{-ld} for @code{ls}.  If your listings are corrupted, you
@c may need to change the value of this variable.
$B$3$l$i$N%3%^%s%I$,=PNO$9$kI=<(7A<0$OJQ?t(B@code{find-ls-option}$B$G(B
$B@)8f$5$l$^$9!#(B
$B%G%U%)%k%H$O!"(B@code{ls}$B$K;H$&%*%W%7%g%s$H$7$F(B@samp{-ld}$B$r;XDj$7$^$9!#(B
$B=PNO7A<0$,2u$l$F8+$($k>l9g$K$O!"(B
$B$3$NJQ?t$NCM$rJQ99$9$kI,MW$,$"$k$+$b$7$l$^$;$s!#(B