File management

Last updated:2020-08-21 18:14:29

1. Can I restore a deleted file or directory?

2. Can I rename a file (object)?

3. How can I create a directory?

4. How can I delete directories?

5. Do files in a deleted directory still exist?

6. Deleting a directory sometimes takes a long period of time. Why?

7. Can I view the permissions of files (objects) in bulk?

8. How can I modify the permissions of files (objects) in bulk?

9. Why cannot I find a file in a specified directory?

10. How can I view the file upload progress?

11. How can I delete files (objects) in bulk?

12. How can I view the size of a directory?

13. Can a directory be renamed?

14. How can I change the Content-Type value of a file?

15. How can I modify object metadata?

16. How can I change the storage types of files?


1. Can I restore a deleted file or directory?

No. Once a file or directory is deleted, it cannot be restored. Delete a file or directory with caution.

2. Can I rename a file (object)?

Yes. You can rename a file by using one of the following methods:

  • On the console, access the Bucket > Content management page page and move the pointer over the file that you want to rename. Select Edit and rename the file.
  • Call the API to copy the file that you want to rename, specify a name for the new file, and then delete the original file.
3. How can I create a directory?

You can create a directory on the console. To do so, log in to the KS3 management console, select the bucket, enter the content management page, and click Create Directory. For more information, see Directory management.
In KS3, directory (or folder) is a virtual concept. A directory or folder is actually an object with a key value that contains a slash sign (/) and a size of 0 KB. Therefore, you can also call the PUT Object API to create a directory.

4. How can I delete directories?

Use one of the following methods:

  • Use GUI tool KS3 Explorer: You can select multiple directories and files to delete them in bulk. This method is not applicable if you want to delete many directories and files at a time.

  • Use the SDK to develop a program to list all objects or objects that use a specific prefix in the bucket and then delete them one by one. For more information, see the batch delete tool, which is developed by using the Java SDK.

  • Use command line tool KS3Util: Execute the :ls command to list objects, save the names of the objects to be deleted (that is, key values of the objects) to a local file, and execute the :multi-del command to delete the objects listed in the local file.

5. Do files in a deleted directory still exist?

No. Deleting a directory also deletes all files in the directory. To use the API to delete a directory and all files in the directory, you must first list all objects in the directory and delete the objects one by one.

6. Deleting a directory sometimes takes a long period of time. Why?

Deleting a directory also deletes all files in the directory. If a large number of files exist in the directory, the underlying delete queue might include many pending items. As a best practice, use the API to list all objects in the directory and delete the objects one by one.

7. How do I view the permissions of files (objects) in bulk?

Use the SDK or API to list all files and then use getACL to view the permissions of files one by one.

8. How can I modify the permissions of files (objects) in bulk?

Use one of the following methods:

  • Use the SDK or API to develop a program to list all files and then modify the permissions of each file.

  • Use the KS3Util to call the list command to generate a file list, and then modify file permissions in bulk based on the file list.

9. Why cannot I find a file in a specified directory?

Identify whether the key value of the directory starts with a slash sign (/). The key value cannot start with a slash sign. For example, the key value can be foldername/filename and cannot be /foldername/filename. If the key value starts with a slash sign, the name of the generated directory is null.

10. How can I view the file upload progress?

While uploading a file on the console, you can view the file upload progress in the upload window as follows:
image.png

While uploading files by using KS3 Explorer, you can view the file upload progress in the task management window as follows:

While uploading files by using data migration tool KS3Up-tool, you can view the file upload progress by executing the following command on the console:

java -jar ks3up-1.0.0.jar -c xxx.conf stat

You can view the number of files that have been uploaded and the number of bytes that have been uploaded as follows:

11. How can I delete files (objects) in bulk?

Use one of the following methods:

  • Use GUI tool KS3 Explorer: You can select multiple directories and files to delete them in bulk. This method is not applicable if you want to delete many directories and files at a time.

  • Use the SDK to develop a program to list all objects or objects that use a specific prefix in a bucket and then delete them one by one. For more information, see the batch delete tool, which is developed by using the Java SDK.

  • Use command line tool KS3Util: Execute the :ls command to list objects, save the names of the objects to be deleted (that is, key values of the objects) to a local file, and execute the :multi-del command to delete the objects listed in the local file.

12. How can I view the size of a directory?

Use one of the following methods:

  • Use the SDK or API to develop a program to collect statistics: First list all files in the directory and then head each file to obtain the file content length. Finally, add the lengths up to get the size of the directory.

  • Use command line tool KS3Util to collect statistics on the directory.

13. Can I change the name of a directory?

Directory name is a logical concept. The name of a directory is the prefix of the files (objects) in the directory. To change the name of a directory, use one of the following methods:

  • Rename all files in the directory.
  • Copy the files, save the files by using new names, and delete the original files.
14. How can I change the Content-Type value of a file?

By default, KS3 identifies the extension of an uploaded file, looks up the file type list for the extension, and thereby sets the Content-Type for the file. The extension of the file is not on the file type list, KS3 sets the Content-Type to application/octet-stream for the file.

You can also specify a Content-Type value for a file when you upload the file. To change the Content-Type value of a file after you upload the file, use one the following methods:

    • API/SDK:

Use PUT Object Copy.

    • On the console:

Follow these steps:

  1. Log in to the KS3 management console.
  2. Click the target file. A Content-Type text box appears at the right side.
  3. Enter the Content-Type value and click Confirm.

File type list

File extension Content-Type File extension Content-Type
ez application/andrew-inset atom application/atom+xml
hqx application/mac-binhex40 cpt application/mac-compactpro
mathml application/mathml+xml doc application/msword
bin dms lha lzh exe class so dll dmg application/octet-stream oda application/oda
ogg application/ogg pdf application/pdf
ai eps ps application/postscript rdf application/rdf+xml
smi smil application/smil gram application/srgs
grxml application/srgs+xml mif application/vnd.mif
xul application/vnd.mozilla.xul+xml xls application/vnd.ms-excel
ppt application/vnd.ms-powerpoint rm application/vnd.rn-realmedia
wbxml application/vnd.wap.wbxml wmlc application/vnd.wap.wmlc
wmlsc application/vnd.wap.wmlscriptc vxml application/voicexml+xml
bcpio application/x-bcpio vcd application/x-cdlink
pgn application/x-chess-pgn cpio application/x-cpio
csh application/x-csh dcr dir dxr application/x-director
dvi application/x-dvi spl application/x-futuresplash
gtar application/x-gtar gz application/x-gzip
hdf application/x-hdf js application/x-javascript
jnlp application/x-java-jnlp-file skp skd skt skm application/x-koan
latex application/x-latex nc cdf application/x-netcdf
sh application/x-sh shar application/x-shar
swf application/x-shockwave-flash sit application/x-stuffit
sv4cpio application/x-sv4cpio sv4crc application/x-sv4crc
tar application/x-tar tcl application/x-tcl
tex application/x-tex texinfo texi application/x-texinfo
t tr roff application/x-troff man application/x-troff-man
me application/x-troff-me ms application/x-troff-ms
ustar application/x-ustar src application/x-wais-source
xhtml xht application/xhtml+xml xslt application/xslt+xml
xml xsl application/xml dtd application/xml-dtd
zip application/zip au snd audio/basic
mid midi kar audio/midi m4a m4p audio/mp4a-latm
mpga mp2 mp3 audio/mpeg aif aiff aifc audio/x-aiff
m3u audio/x-mpegurl ram ra audio/x-pn-realaudio
wav audio/x-wav pdb chemical/x-pdb
xyz chemical/x-xyz bmp image/bmp
cgm image/cgm gif image/gif
ief image/ief jpeg jpg jpe image/jpeg
jp2 image/jp2 pict pic pct image/pict
png image/png svg image/svg+xml
tiff tif image/tiff djvu djv image/vnd.djvu
wbmp image/vnd.wap.wbmp ras image/x-cmu-raster
pntg pnt mac image/x-macpaint ico image/x-icon
pnm image/x-portable-anymap pbm image/x-portable-bitmap
pgm image/x-portable-graymap ppm image/x-portable-pixmap
qtif qti image/x-quicktime rgb image/x-rgb
xbm image/x-xbitmap xpm image/x-xpixmap
xwd image/x-xwindowdump igs iges model/iges
msh mesh silo model/mesh wrl vrml model/vrml
ics ifb text/calendar css text/css
html htm text/html asc txt text/plain
rtx text/richtext rtf text/rtf
sgml sgm text/sgml tsv text/tab-separated-values
wml text/vnd.wap.wml wmls text/vnd.wap.wmlscript
etx text/x-setext 3gp video/3gpp
mp4 video/mp4 mpeg mpg mpe video/mpeg
ogv video/ogv qt mov video/quicktime
qt mov video/quicktime mxu m4u video/vnd.mpegurl
webm video/webm dv dif video/x-dv
flv video/x-flv m4v video/x-m4v
wmv video/x-ms-wmv avi video/x-msvideo
movie video/x-sgi-movie ice x-conference/x-cooltalk
15. How can I modify object metadata?

Object metadata refers to descriptions of the attributes of a file that is uploaded to KS3. There are two types of object metadata: standard HTTP attributes (HTTP headers) and custom metadata. You can set object metadata when uploading or copying a file.

  • Standard HTTP attributes:

    Name Description
    Cache-Control Web page caching behavior when the object is downloaded.
    Content-Disposition Name when the object is downloaded.
    Content-Encoding Content encoding format when the object is downloaded.
    Expires Expiration time.
    Content-Length Object size.
    Content-Type File type.
  • Custom object metadata:

For users to add more object descriptions conveniently, KS3 identifies all parameters prefixed with **x-kss-meta-** as custom object metadata, for example, x-kss-meta-location. The data will be carried in the HTTP header of the message returned in response to a GetObject or HeadObject operation.

Operation methods

Operation method Description
Console Web application, intuitive and easy to use.
API See https://docs.ksyun.com/documents/941.
16. How can I change the storage types of files?

See Convert between storage classes.

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

Insufficient
Outdated
Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈