Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

How-to

How to rename hundreds of files on a server

FTP by Zaweba's bulk rename changes hundreds of server file names by rules you stack up, with a full preview before a single file is touched.

How to rename hundreds of files on a server

Renaming hundreds of files directly on the server is a job for bulk rename in the Disk view of FTP by Zaweba. Choose the files, add one or more rules, check the preview of every old and new name, then press Rename. Nothing changes on the server until that last click.

The usual alternative is downloading the files, renaming them on your PC and uploading them again, which is slow, doubles the risk of mistakes and leaves the old names behind on the server unless you remember to delete them. Renaming in place avoids all of that.

Choosing the files

Open Disk from the toolbar or the Site menu and let it scan the site. Then pick the files you want to rename. For a single folder, tag the folder. For files spread across the site, Tag by can match a filespec such as *.jpg, a type, a size or how long ago they were modified, looking in the list, in the current branch or across the whole scan. Tagged files can be renamed together.

Building the rules

Bulk rename works with rules applied top to bottom, so each one acts on the result of the one above. That lets you build a rename out of simple steps instead of one clever pattern.

The rules on offer are Replace, for swapping one piece of text for another; Regex, for patterns; Wildcard, for simple shapes such as *.htm to *.html; Case, for changing capitals; Add text, for putting something at the start or end; New name or number, for numbering files with a step and an order, optionally starting again in each folder; and Clean up, which tidies names by making spaces single, removing doubled hyphens and underscores, trimming the ends, removing accents and keeping web-safe characters only.

Rules can be moved up or down, switched off without deleting them, or removed. Switching one off is a quick way to see what difference it makes in the preview.

Reading the preview

The preview is the point of the whole window. It lists every file with its current name and the name it will have, before anything changes. Read it properly. Look for names that come out the same as each other, names that lose their extension, and rules that matched files you didn't mean.

Protected items are left out automatically. Files such as .htaccess, wp-config.php and .env, the web root and cPanel folders can break a site or hosting account if they are renamed, so Disk won't touch them unless a site option allows it.

When the preview is right, press Rename.

After the rename

Renamed files often have pages pointing at them. FTP by Zaweba's link awareness looks for references to the old paths in the linked local site, across .php, .html, .css, .js and .htaccess files, and offers to rewrite them in the same style they were written. Only local files are edited, and it can be undone. Upload the updated pages afterwards and the site keeps working.

If the rename turns out to be a mistake, the operations log has it as a batch, and Undo this batch puts every name back.

Tips for big batches

Try the rules on a small set first. Tag one folder, build the rules, check the preview and run it. Once you trust the rules, tag the rest and run them again.

Keep the scan connections at a level your host accepts, 3 being the safe number on shared hosting, so the renames don't trip connection limits. If the host refuses extra connections, Disk carries on with fewer.

Export the list to CSV before you start if you want a record of the original names outside the app.

Other routes

Some hosts offer a file manager with renaming, but usually one file at a time. A shell account can rename with commands, which is quick if you know them and unforgiving if you don't. Bulk rename in FTP by Zaweba sits between the two: it works over the same FTP, FTPS or SFTP connection you already use, and shows you every result before it happens.