KIO::BatchRenameJob Class

class KIO::BatchRenameJob

A KIO job that renames multiple files in one go. More...

Header: #include <KIO/BatchRenameJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)
Since: 5.42
Inherits: KIO::Job

Signals

void fileRenamed(const QUrl &oldUrl, const QUrl &newUrl)

Protected Slots

virtual void slotResult(KJob *job) override
(since 5.42) KIO::BatchRenameJob *batchRename(const QList<QUrl> &src, const QString &newName, int index, QChar placeHolder, KIO::JobFlags flags = DefaultFlags)

Detailed Description

Member Function Documentation

[signal] void BatchRenameJob::fileRenamed(const QUrl &oldUrl, const QUrl &newUrl)

Signals that a file was renamed.

[override virtual protected slot] void BatchRenameJob::slotResult(KJob *job)

Reimplements: KCompositeJob::slotResult(KJob *job).

Related Non-Members

[since 5.42] KIO::BatchRenameJob *batchRename(const QList<QUrl> &src, const QString &newName, int index, QChar placeHolder, KIO::JobFlags flags = DefaultFlags)

Renames multiple files at once.

The new filename is obtained by replacing the characters represented by placeHolder by the index index.

E.g. Calling batchRename({"file:///Test.jpg"}, "Test #" 12, '#') renames the file to "Test 12.jpg". A connected sequence of placeholders results in leading zeros. batchRename({"file:///Test.jpg"}, "Test ####" 12, '#') renames the file to "Test 0012.jpg". And if no placeholder is there then index is appended to newName. Calling batchRename({"file:///Test.jpg"}, "NewTest" 12, '#') renames the file to "NewTest12.jpg".

src The list of items to rename.

newName The base name to use in all new filenames.

index The integer(incremented after renaming a file) to add to the base name.

placeHolder The character(s) which index will replace.

Returns a pointer to the job handling the operation.

This function was introduced in 5.42.