FG

Replace spaces in file names from cmd line unix

Fresh3 days ago
Mar 15, 20264799 views
Confidence Score0%
0%

Problem

Hi I have a bunch of files with spaces in the name, is there a way to mv them to new files without spaces in. For example I have the file Hello World.pdf I want to move it to Hello_World.pdf. Obviously for the one file I can use the mv command but I want to do it to all files in a folder. Thanks

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Replace spaces in file names from cmd line unix

Low Risk

You can use the tr or sed commands for this: Note that this uses the newer POSIX syntax for command substitution: $(command). If you're using a really old Bourne shell, you'll need to use backticks:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment