Skip to content

Commit 0f8be5e

Browse files
committed
Add more examples under 'File Operand Shell Expansion'
1 parent cd5a357 commit 0f8be5e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ File Operand Shell Expansion
4343
Some Unix shells like Bash have a brace expansion feature that can be useful when combined with `touch`. For example, in a Bash shell, you could execute `touch File{1..3}`, which would create the files `File1`, `File2`, and `File3` if they do not exist, or update their timestamps if they exist. This is also possible on Windows with PowerShell, although the syntax is a little bit wordy. Here are some examples:
4444
```powershell
4545
# Creates the files or updates timestamps of File1, File2, File2
46-
# Note: double quotes around filenames are a must!
46+
# Double quotes around filenames are a must!
4747
touch (1..3 | % { "File$_" })
4848
4949
# A more complex version of the above that support string formatting
@@ -52,6 +52,13 @@ touch (1..3 | % { "File{0:d3}" -f $_ })
5252
5353
# Creates the files or updates timestamps of FileA, FileB, FileC
5454
touch ('A'[0]..'C'[0] | % { "File" + [char]$_ })
55+
56+
# Updates the timestamps of all files ending with .txt
57+
touch -c (gi *.txt)
58+
59+
# Updates the timestamps of all files in Dir/
60+
# It will NOT recurse subdirectories!
61+
touch -c (gi Dir/*)
5562
```
5663

5764
Unicode Support

0 commit comments

Comments
 (0)