@@ -79,12 +79,13 @@ exists
79
79
~~~~~~
80
80
81
81
:method: `Symfony\\ Component\\ Filesystem\\ Filesystem::exists ` checks for the
82
- presence of all files or directories and returns ``false `` if a file is missing::
82
+ presence of one or more files or directories and returns ``false `` if any of
83
+ them is missing::
83
84
84
85
// this directory exists, return true
85
86
$fs->exists('/tmp/photos');
86
87
87
- // rabbit.jpg exists, bottle.png does not exists , return false
88
+ // rabbit.jpg exists, bottle.png does not exist , return false
88
89
$fs->exists(array('rabbit.jpg', 'bottle.png'));
89
90
90
91
.. note ::
@@ -95,10 +96,11 @@ presence of all files or directories and returns ``false`` if a file is missing:
95
96
copy
96
97
~~~~
97
98
98
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::copy ` is used to copy
99
- files. If the target already exists, the file is copied only if the source
100
- modification date is later than the target. This behavior can be overridden by
101
- the third boolean argument::
99
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::copy ` makes a copy of a
100
+ single file (use :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::mirror ` to
101
+ copy directories). If the target already exists, the file is copied only if the
102
+ source modification date is later than the target. This behavior can be overridden
103
+ by the third boolean argument::
102
104
103
105
// works only if image-ICC has been modified after image.jpg
104
106
$fs->copy('image-ICC.jpg', 'image.jpg');
@@ -128,8 +130,8 @@ your own with the second argument. The third argument is the access time::
128
130
chown
129
131
~~~~~
130
132
131
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chown ` is used to change
132
- the owner of a file. The third argument is a boolean recursive option::
133
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chown ` changes the owner of
134
+ a file. The third argument is a boolean recursive option::
133
135
134
136
// set the owner of the lolcat video to www-data
135
137
$fs->chown('lolcat.mp4', 'www-data');
@@ -144,8 +146,8 @@ the owner of a file. The third argument is a boolean recursive option::
144
146
chgrp
145
147
~~~~~
146
148
147
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chgrp ` is used to change
148
- the group of a file. The third argument is a boolean recursive option::
149
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chgrp ` changes the group of
150
+ a file. The third argument is a boolean recursive option::
149
151
150
152
// set the group of the lolcat video to nginx
151
153
$fs->chgrp('lolcat.mp4', 'nginx');
@@ -160,8 +162,8 @@ the group of a file. The third argument is a boolean recursive option::
160
162
chmod
161
163
~~~~~
162
164
163
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chmod ` is used to change
164
- the mode of a file. The fourth argument is a boolean recursive option::
165
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::chmod ` changes the mode or
166
+ permissions of a file. The fourth argument is a boolean recursive option::
165
167
166
168
// set the mode of the video to 0600
167
169
$fs->chmod('video.ogg', 0600);
@@ -176,8 +178,8 @@ the mode of a file. The fourth argument is a boolean recursive option::
176
178
remove
177
179
~~~~~~
178
180
179
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::remove ` is used to remove
180
- files, symlinks, directories easily ::
181
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::remove ` deletes files,
182
+ directories and symlinks ::
181
183
182
184
$fs->remove(array('symlink', '/path/to/directory', 'activity.log'));
183
185
@@ -189,8 +191,8 @@ files, symlinks, directories easily::
189
191
rename
190
192
~~~~~~
191
193
192
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::rename ` is used to rename
193
- files and directories ::
194
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::rename ` changes the name
195
+ of a single file or directory ::
194
196
195
197
// rename a file
196
198
$fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
@@ -213,8 +215,8 @@ support symbolic links, a third boolean argument is available::
213
215
makePathRelative
214
216
~~~~~~~~~~~~~~~~
215
217
216
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::makePathRelative ` returns
217
- the relative path of a directory given another one::
218
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::makePathRelative ` takes two
219
+ absolute paths and returns the relative path from the second path to the first one::
218
220
219
221
// returns '../'
220
222
$fs->makePathRelative(
@@ -227,8 +229,10 @@ the relative path of a directory given another one::
227
229
mirror
228
230
~~~~~~
229
231
230
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::mirror ` mirrors a
231
- directory::
232
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::mirror ` copies all the
233
+ contents of the source directory into the target one (use the
234
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::copy ` method to copy single
235
+ files)::
232
236
233
237
$fs->mirror('/path/to/source', '/path/to/target');
234
238
@@ -253,8 +257,8 @@ dumpFile
253
257
.. versionadded :: 2.3
254
258
The ``dumpFile() `` was introduced in Symfony 2.3.
255
259
256
- :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::dumpFile ` allows you to
257
- dump contents to a file. It does this in an atomic manner: it writes a temporary
260
+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::dumpFile ` saves the given
261
+ contents into a file. It does this in an atomic manner: it writes a temporary
258
262
file first and then moves it to the new file location when it's finished.
259
263
This means that the user will always see either the complete old file or
260
264
complete new file (but never a partially-written file)::
0 commit comments