FileRename

Version 1.0.0.1 (8,26 KB) von Jan
Fast renaming of files or folders
3,3K Downloads
Aktualisiert 7 Jan 2023

Lizenz anzeigen

Rename file or folder
This function renames the existing file or folder specified by the CHAR vector Source to the name given by the CHAR vector Dest. This C-Mex is much faster than Matlab's MOVEFILE (timings vary with the size and number of the files due to caching of write operations, see screenshot):
R2018b: 15 times faster
R2009a: 10 to 50 times faster
R6.5: 1600 times faster
This C-Mex is about 25% faster than using java.io.File().renameTo().
[Status, Msg] = FileRename(Source, Dest, [Mode])
INPUT:
Source: CHAR vector, name of the source file or folder.
Unicode and UNC paths are considered.
Dest: CHAR vector, name of the destination file or folder.
Mode: CHAR vector, if 'forced' an existing Dest file is overwritten,
if it is not write protected. Folders are *not* overwritten.
Optional, default: 'DoNotOverwrite'.
OUTPUT:
Status: Scalar DOUBLE. Optional.
0: Success
-1: Source is not existing
-2: Dest is existing already
-3: Dest is write protected
-4: Unknown problems:
Source or Dest is accessed from another program,
Source is a folder and Dest is on another drive.
Msg: CHAR, empty on success, some information in case of problems.
COMPILE: The fast C-Mex file must be compiled before using.
See FileRename.c for details.
Pre-compiled: http://www.n-simon.de/mex
Tested: Matlab 6.5, 2009a, 2015b(32/64), 2016b, 2018b, Win7/10
Compiler: LCC2.4 (Matlab2009a), OWC1.8, BCC5.5, MSVC2008/2017
Assumed Compatibility: higher Matlab versions, Mac, Linux, 32/64bit

Zitieren als

Jan (2024). FileRename (https://www.mathworks.com/matlabcentral/fileexchange/29569-filerename), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2018b
Kompatibel mit R13SP1 und späteren Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Low-Level File I/O finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.1

Only the description has changed.

1.0.0.0