Visual QuickStart Guide [Electronic resources] : Mac OS X 10.4 Tiger نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Visual QuickStart Guide [Electronic resources] : Mac OS X 10.4 Tiger - نسخه متنی

Maria Langer

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید





Wildcards in File Names & Directories


One frustrating activity in Mac OS 9.x and earlier was working with a group of files. Other than Shift-clicking or dragging to select the group, you had no good way to select group items by namefor example, to select all files that started with the characters

file and ended with the characters

.doc .

Unix, however, makes this easy by enabling you to use three special characters as wildcards:

    Asterisk (*), which is referred to as star, is a wildcard for zero or more charactersany character!

    Question mark (?) is a wildcard for any single character.

    Brackets ([ and ]) around one or more characters act as a wildcard for any of the enclosed characters.


You can place the wildcard wherever you want in the name you are searching for. As you can imagine, wildcards are powerful tools for selecting or listing files or subdirectories.

Tip

    The brackets wildcard can include individual characters, such as [ABCD] or character ranges, such as [A-G] or [1-6].

Using wildcards


The best way to explain how you can use wildcards is to show you some examples.

Suppose your Documents subdirectory contained the following subdirectories and files:

dir1

file03.doc

file12.txt

dir2

file04.doc

file20.txt

dir30

file05.doc

file21.txt

file01.doc

file10.txt

file38.txt

file02.doc

file11.txt

file39.txt

Here are some examples to illustrate the asterisk wildcard (Figure 18 ):

    To work with all the files that start with the characters

    file , you enter file*.

    To work with all the files that begin with the characters

    file and end with the characters

    doc , you enter file*doc.

    To work with all the files that end with the characters

    txt , you enter *txt.


Figure 18. These examples show how you can use the asterisk wildcard to list specific files in a directory.

These examples illustrate the question mark wildcard (Figure 19 ):

    To work with files named

    file10.txt, file11.txt , and

    file12.txt , you enter file1?.txt.

    To work with files named

    file10.txt and

    file20.txt , you enter file?0.txt.

    To work with subdirectories named

    dir1 and

    dir2 , you enter dir?.

    To work with files named

    file01.doc, file11.txt , and

    file21.txt , you enter file?1.*. (Okay, so that one uses two wildcards.)


Figure 19. These examples show the question mark wildcard in action. (Both dir1 and dir2 are empty directories; that's why no files are listed for them.)

And these examples illustrate the brackets wildcard in action (Figure 20 ):

    To work with files named

    file11.txt and

    file12.txt (but not

    file10.txt ), you enter file1[12].txt.

    To work with files named

    file01.doc, file10.txt , and

    file11.txt , you enter file[01][01].*. (Yes, that's another one with multiple wildcard characters.)


Figure 20. Here are two examples for the bracket wildcard.

To view a directory list using a wildcard


Type ls followed by the search string for the files or directories you want to display (see previous examples) and press .

A list containing only the files and directories that match the search string appear (

/ 300