One script, three files, changes you can inspect

Batch Text Processing on Mac

notePad++++ can run the same script on every selected text file in a workspace, including files in subfolders. This walkthrough uses the built-in Extract URLs script: confirm the targets, preview each result, apply the changes, then inspect the backups and restore the files.

Written by the App developer. The directory screenshots use a temporary workspace with three fictional TXT files. A separate custom-script preview near the end shows a different rule on one document.

Real notePad++++ directory-script preview for release-links.txt, showing the original labelled text and the URLs returned by Extract URLs.

Actual Extract URLs directory preview. The labels are removed and the matching links are returned one per line, with their original order and duplicates preserved.

Source: Actual notePad++++ screenshot

On this page

1. Choose a built-in script or make your own

Start with the text operation you need: extract URLs, remove blank lines, trim spaces or change a repeated identifier. Choose a ready-made script, or write a JavaScript run(ctx) function for your own rule. One function can perform several text transformations before returning its result.

The real JS Script window below has Extract URLs selected. It collects matching HTTP and HTTPS links from the supplied text, one per line. The script preserves their order and keeps duplicate matches, so extracting links and removing duplicates are separate choices.

Built-in scripts are marked Built-in · Read Only. Choose Copy as My Script if you want to edit the rule and save a named version under My Scripts. You can run that saved script on one document or select it for a whole directory.

Use Demo to try the built-in sample without changing your open document. Once the result is right, use the workspace controls to choose the real folder targets.

Real notePad++++ JS Script panel with the Extract URLs code, Built-in Read Only badge, Copy as My Script, Demo and shortcut controls.

The actual script editor, using the developer-supplied screenshot. The same Extract URLs script is used for the directory example below.

Source: Actual notePad++++ screenshot

  • Use a built-in script for a common text operation.
  • Copy it to My Scripts when you need to change the rule.
  • Combine several cleanup actions inside one JavaScript function if needed.
  • Reuse the saved script on selected files in a folder.

2. Select a folder and confirm the target files

Open the workspace folder, select Extract URLs and narrow the batch targets to TXT files. The script runs on each selected file; the App manages opening the files and writing approved results. The JavaScript itself does not need file-system access.

This sample contains release-links.txt and incident-links.txt in the root folder, plus team/reference-links.txt in a subfolder. README.md explains the example and is excluded by the TXT filter.

Read the names and relative paths in the confirmation window. Choose Preview mode (no disk writes) to calculate the proposed results first. This workflow changes the contents of the selected files, while their names remain the same.

Real notePad++++ Extract URLs confirmation listing release-links.txt, incident-links.txt and team/reference-links.txt for preview without disk writes.

Actual script-directory target confirmation: three TXT files, including one in a subfolder. README.md is outside the selected file type.

Source: Actual notePad++++ screenshot

3. Preview the script result for each file

The opening screenshot shows the Extract URLs result for release-links.txt. The source contains Docs, Preview and repeated-link labels. Result View contains the three matching URLs, one per line. The documentation link still occurs twice because the built-in rule preserves duplicate matches.

Review each target file, including files in subfolders. A result that is correct for one document does not prove every other input has the format you expected. The table below summarizes the outputs for this sample workspace.

Preview mode leaves the original files unchanged. Apply and Apply All are separate write actions; choose them after checking the proposed changes. This script extracts URL text locally and does not fetch the linked pages.

Expected results for the three TXT files

Expected results for the three TXT files
FileOutput linesWhat the script keeps
release-links.txt3The documentation link, the banner URL and the repeated documentation link, in order.
incident-links.txt2The status-page and runbook URLs.
team/reference-links.txt2The HTTP project URL and the HTTPS support URL.

Run the same script on a folder on your Mac

Download notePad++++, open the sample workspace, select Extract URLs and preview the TXT files before applying a directory-wide change. Folder batch processing and its operation history require Pro access or an eligible trial.

Download notePad++++ on the App Store

See the App Store listing for current pricing and macOS requirements.

4. Apply the reviewed results and inspect the backups

After applying the reviewed changes, open Operation History for the same workspace. The real operation details below identify Extract URLs and list the three modified TXT files.

Each file has a Diff control and an Available backup status in this capture. Use the per-file details to inspect what changed, and read the outcome for errors or skipped files.

The operation shown here has a backup for each modified file. With backup creation enabled, a failed backup stops the affected write and is reported as an error. Check that backups are available before relying on restoration.

Real notePad++++ Extract URLs operation history showing three modified TXT files with Available backups and Restore this operation.

The actual Extract URLs operation after applying the reviewed results. The three modified files have available backups.

Source: Actual notePad++++ screenshot

5. Restore the files while backups are available

Choose Restore this operation from the operation details to recover the backed-up contents. In this demonstration, the three TXT files are restored to their original labelled text; the excluded README.md remains unchanged.

Batch backups are retained for seven days. Files edited since the batch operation, or open with unsaved changes, are skipped during restoration so a newer edit is not overwritten. Missing or expired backups cannot be restored.

Read the restoration result for skipped files or errors, and keep your normal backups for important work.

Real notePad++++ Extract URLs operation details showing release-links.txt, incident-links.txt and reference-links.txt marked Restored.

The same script operation after restoration. All three demonstration files are marked Restored.

Source: Actual notePad++++ screenshot

6. Check a custom rule on one document before a folder run

For a different job, write or adapt your own script and save it under My Scripts. A single JavaScript function can trim spaces, filter lines, remove duplicates and sort the result, or perform a completely different text transformation.

The separate real preview below shows a custom rule named Demo - OLD to NEW. It replaces OLD- with NEW- only at the beginning of each line. Four ID lines change; duplicate IDs, their order and blank lines remain.

This capture illustrates the single-document Cancel and Apply to Document controls. Once the result matches your intent, select that custom script in the workspace batch controls, choose the folder targets and preview each file before applying it.

Real notePad++++ Script Change Preview for the custom Demo - OLD to NEW rule, showing four prefix changes with Cancel and Apply to Document.

A separate custom-script preview on one document. Only the OLD- prefix changes; blank lines and duplicate IDs are preserved.

Source: Actual notePad++++ screenshot

7. Keep a useful script close by, with optional AI help

Save a rule you use repeatedly, pin it to the main toolbar and assign an available script shortcut. The script remains the same whether you run it on one document or reuse it across selected workspace files.

AI Guide provides instructions for the App’s script format. For editable scripts, the optional AI Script Assistant can help create or modify code after you configure your provider and API access. The assistant requires Pro access or an eligible trial, and the provider may charge for use. Review the generated code and test its output.

Ordinary text-processing scripts run locally. AI is optional, and scripts do not get direct access to arbitrary files, the network or system commands. The App manages access to the documents and workspace folder you authorize.

FAQ

Can one script process a whole directory of text files?

Yes. In notePad++++, select a built-in or saved custom script, choose the workspace folder and narrow the targets by file type. The App runs the same function on each selected file, including selected files in subfolders. Folder batch processing and its operation history require Pro access or an eligible trial.

Can a single script perform several cleanup actions?

Yes. A JavaScript run(ctx) function can combine operations such as trimming, filtering, deduplication and sorting before it returns the resulting text.

Does Preview mode change my files?

No. Preview mode calculates the proposed results without disk writes. Apply and Apply All are separate actions that write changes.

Does Extract URLs remove duplicate links?

No. The built-in script preserves matching URLs in their original order, including duplicates. Make an editable copy and add deduplication if your task needs unique links.

How long can I restore a batch operation?

Backups are retained for seven days. Files changed since the operation or open with unsaved edits are skipped during restoration. Missing or expired backups cannot be restored.

Do I need AI to batch process a folder?

No. Built-in and custom text-processing scripts run locally. Optional AI assistance needs a configured provider and API access, plus Pro access or an eligible trial.

Run the same script on a folder on your Mac

Download notePad++++, open the sample workspace, select Extract URLs and preview the TXT files before applying a directory-wide change. Folder batch processing and its operation history require Pro access or an eligible trial.

Download notePad++++ on the App Store

See the App Store listing for current pricing and macOS requirements.