Shell Commands/SetFileSize

From MorphOS Library

Revision as of 12:52, 29 June 2026 by JPV (talk | contribs) (Created page with "'''SetFileSize''' - Creates or resizes a file FILE/A,SIZE/A,KIB/S,MIB/S,GIB/S <nowiki> FILE - File to resize or create SIZE - Size to be applied to the specified file, in by...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Shell Commands

SetFileSize - Creates or resizes a file

FILE/A,SIZE/A,KIB/S,MIB/S,GIB/S

FILE - File to resize or create
SIZE - Size to be applied to the specified file, in bytes by default
KIB  - Multiplies the specified size by 1024
MIB  - Multiplies the specified size by 1024*1024
GIB  - Multiplies the specified size by 1024*1024*1024

NOTE that the resize operation may or may not destroy contents of the file. It depends on the file system used, so consider the result as undefined. The command is meant to create large files quickly, for example, as virtual file images, where formatting would rewrite the data within the file anyway.

The FileWrite command can be used to create a file that is filled with the specified data.

Examples:

Creates a file named "Testfile" in "T:" with the size of 10 bytes:

SetFileSize T:Testfile 10

Resizes the file to 10485760 bytes:

SetFileSize T:Testfile 10 MIB