@@ -47,8 +47,9 @@ endpoint for filesystem operations::
47
47
Mkdir
48
48
~~~~~
49
49
50
- Mkdir creates directory. On posix filesystems, directories are created with a
51
- default mode value `0777 `. You can use the second argument to set your own mode::
50
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::mkdir ` creates directory.
51
+ On posix filesystems, directories are created with a default mode value
52
+ `0777 `. You can use the second argument to set your own mode::
52
53
53
54
$fs->mkdir('/tmp/photos', 0700);
54
55
@@ -60,8 +61,8 @@ default mode value `0777`. You can use the second argument to set your own mode:
60
61
Exists
61
62
~~~~~~
62
63
63
- Exists checks for the presence of all files or directories and returns false if a
64
- file is missing::
64
+ :method: ` Symfony \\ Component \\ Filesystem \\ Filesystem::exists ` checks for the
65
+ presence of all files or directories and returns false if a file is missing::
65
66
66
67
// this directory exists, return true
67
68
$fs->exists('/tmp/photos');
@@ -77,9 +78,10 @@ file is missing::
77
78
Copy
78
79
~~~~
79
80
80
- This method is used to copy files. If the target already exists, the file is
81
- copied only if the source modification date is later than the target. This
82
- behavior can be overridden by the third boolean argument::
81
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::copy ` is used to copy
82
+ files. If the target already exists, the file is copied only if the source
83
+ modification date is later than the target. This behavior can be overridden by
84
+ the third boolean argument::
83
85
84
86
// works only if image-ICC has been modified after image.jpg
85
87
$fs->copy('image-ICC.jpg', 'image.jpg');
@@ -90,9 +92,9 @@ behavior can be overridden by the third boolean argument::
90
92
Touch
91
93
~~~~~
92
94
93
- Touch sets access and modification time for a file. The current time is used by
94
- default. You can set your own with the second argument. The third argument is
95
- the access time::
95
+ :method: ` Symfony \\ Component \\ Filesystem \\ Filesystem::touch ` sets access and
96
+ modification time for a file. The current time is used by default. You can set
97
+ your own with the second argument. The third argument is the access time::
96
98
97
99
// set modification time to the current timestamp
98
100
$fs->touch('file.txt');
@@ -109,8 +111,8 @@ the access time::
109
111
Chown
110
112
~~~~~
111
113
112
- Chown is used to change the owner of a file. The third argument is a boolean
113
- recursive option::
114
+ :method: ` Symfony \\ Component \\ Filesystem \\ Filesystem::chown ` is used to change
115
+ the owner of a file. The third argument is a boolean recursive option::
114
116
115
117
// set the owner of the lolcat video to www-data
116
118
$fs->chown('lolcat.mp4', 'www-data');
@@ -125,8 +127,8 @@ recursive option::
125
127
Chgrp
126
128
~~~~~
127
129
128
- Chgrp is used to change the group of a file. The third argument is a boolean
129
- recursive option::
130
+ :method: ` Symfony \\ Component \\ Filesystem \\ Filesystem::chgrp ` is used to change
131
+ the group of a file. The third argument is a boolean recursive option::
130
132
131
133
// set the group of the lolcat video to nginx
132
134
$fs->chgrp('lolcat.mp4', 'nginx');
@@ -142,8 +144,8 @@ recursive option::
142
144
Chmod
143
145
~~~~~
144
146
145
- Chmod is used to change the mode of a file. The fourth argument is a boolean
146
- recursive option::
147
+ :method: ` Symfony \\ Component \\ Filesystem \\ Filesystem::chmod ` is used to change
148
+ the mode of a file. The fourth argument is a boolean recursive option::
147
149
148
150
// set the mode of the video to 0600
149
151
$fs->chmod('video.ogg', 0600);
@@ -158,7 +160,8 @@ recursive option::
158
160
Remove
159
161
~~~~~~
160
162
161
- Remove let's you remove files, symlink, directories easily::
163
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::remove ` let's you remove
164
+ files, symlink, directories easily::
162
165
163
166
$fs->remove(array('symlink', '/path/to/directory', 'activity.log'));
164
167
@@ -170,7 +173,8 @@ Remove let's you remove files, symlink, directories easily::
170
173
Rename
171
174
~~~~~~
172
175
173
- Rename is used to rename files and directories::
176
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::rename ` is used to rename
177
+ files and directories::
174
178
175
179
//rename a file
176
180
$fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
@@ -180,8 +184,9 @@ Rename is used to rename files and directories::
180
184
symlink
181
185
~~~~~~~
182
186
183
- Creates a symbolic link from the target to the destination. If the filesystem
184
- does not support symbolic links, a third boolean argument is available::
187
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::symlink ` creates a
188
+ symbolic link from the target to the destination. If the filesystem does not
189
+ support symbolic links, a third boolean argument is available::
185
190
186
191
// create a symbolic link
187
192
$fs->symlink('/path/to/source', '/path/to/destination');
@@ -192,7 +197,8 @@ does not support symbolic links, a third boolean argument is available::
192
197
makePathRelative
193
198
~~~~~~~~~~~~~~~~
194
199
195
- Return the relative path of a directory given another one::
200
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::makePathRelative ` returns
201
+ the relative path of a directory given another one::
196
202
197
203
// returns '../'
198
204
$fs->makePathRelative(
@@ -205,14 +211,16 @@ Return the relative path of a directory given another one::
205
211
mirror
206
212
~~~~~~
207
213
208
- Mirrors a directory::
214
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::mirror ` mirrors a
215
+ directory::
209
216
210
217
$fs->mirror('/path/to/source', '/path/to/target');
211
218
212
219
isAbsolutePath
213
220
~~~~~~~~~~~~~~
214
221
215
- isAbsolutePath returns true if the given path is absolute, false otherwise::
222
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::isAbsolutePath ` returns
223
+ ``true `` if the given path is absolute, false otherwise::
216
224
217
225
// return true
218
226
$fs->isAbsolutePath('/tmp');
@@ -248,4 +256,11 @@ Whenever something wrong happens, an exception implementing
248
256
:class: `Symfony\\ Component\\ Filesystem\\ Exception\\ ExceptionInterface ` is
249
257
thrown.
250
258
259
+ .. note ::
260
+
261
+ Prior to version 2.1, ``mkdir `` returned a boolean and did not throw
262
+ exceptions. As of 2.1, a
263
+ :class: `Symfony\\ Component\\ Filesystem\\ Exception\\ IOException ` is thrown
264
+ if a directory creation fails.
265
+
251
266
.. _`Packagist` : https://packagist.org/packages/symfony/filesystem
0 commit comments