Skip to content

Commit cb657c8

Browse files
committed
SFTP: add info on touch, chown, chgrp and truncate
1 parent 694a74d commit cb657c8

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

sftp/examples.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ <h1>php<span class="red">sec</span>lib: SFTP Examples and Notes</h1>
134134
<option value="get">Download File</option>
135135
<option value="dir">Directory Management</option>
136136
<option value="list">Directory Listing</option>
137-
<option value="chmod">Change Permissions</option>
137+
<option value="attr">File Attributes</option>
138138
<option value="stat">File Information</option>
139139
<option value="delete">Delete and Rename</option>
140140
</select>
@@ -174,8 +174,15 @@ <h1>php<span class="red">sec</span>lib: SFTP Examples and Notes</h1>
174174
//$sftp->delete('test', true);</span><span style="display: none">
175175
</span><span class="list">print_r($sftp->nlist()); // == $sftp->nlist('.')
176176
print_r($sftp->rawlist()); // == $sftp->rawlist('.')</span><span style="display: none">
177-
</span><span class="chmod">$sftp->chmod(0777, 'filename.remote');
178-
//$sftp->chmod(0777, 'dirname.remote', true); // recursively change permissions on a directory</span><span style="display: none">
177+
</span><span class="attr">$sftp->chmod(0777, 'filename.remote');
178+
//$sftp->chmod(0777, 'dirname.remote', true); // recursively change permissions on a directory
179+
// has the same syntax as <a href="http://php.net/touch">http://php.net/touch</a>
180+
$sftp->touch('filename.remote');
181+
$sftp->chown('filename.remote', $uid);
182+
//$sftp->chown('filename.remote', $uid, true); // recursively change the owner
183+
$sftp->chgrp('filename.remote', $gid);
184+
//$sftp->chgrp('filename.remote', $gid, true); // recursively change the group
185+
$sftp->truncate('filename.remote', $size);</span><span style="display: none">
179186
</span><span class="stat">echo $sftp->size('filename.remote');
180187
print_r($sftp->stat('filename.remote'));
181188
print_r($sftp->lstat('filename.remote'));</span><span class="delete">$sftp->delete('filename.remote'); // doesn't delete directories

sftp/intro.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ <h2>Features</h2>
7070
</ul>
7171
</li>
7272
<li><a href="examples.html#list">Directory Listing</a> (<code>nlist</code> and <code>rawlist</code>)</li>
73-
<li><a href="examples.html#chmod">Change Permissions</a> (<code>chmod</code>)</li>
73+
<li>
74+
<a href="examples.html#attr">Change Attributes</a>
75+
<ul>
76+
<li>Permissions (<code>chmod</code>)</li>
77+
<li>Date (<code>touch</code>)</li>
78+
<li>(Group) Ownership (<code>chgrp</code>, <code>chown</code>)</li>
79+
<li>Size (<code>truncate</code></li>)
80+
</ul>
81+
</li>
7482
<li><a href="examples.html#stat">File Information</a> (<code>stat</code>, <code>lstat</code> and <code>size</code>)</li>
7583
<li><a href="examples.html#delete">Delete and Rename</a> (<code>delete</code> and <code>rename</code>)</li>
7684
<li>

0 commit comments

Comments
 (0)