[dolphin] [Bug 428180] A shell script to rename files, which works perfectly in terminal, leaves a leading space in filename

Sadi bugzilla_noreply at kde.org
Fri Oct 30 19:33:31 GMT 2020


https://bugs.kde.org/show_bug.cgi?id=428180

--- Comment #5 from Sadi <sadiyumusak at gmail.com> ---
(In reply to David Greengas from comment #4)

Unfortunately I don't know much about this rename package I've installed from
official Ubuntu repositories. 
It seems it's a small Perl tool making use of sed to rename files.

We can test it in terminal like this:

mkdir rename
cd 

touch "   a truly file name"$'\n'"with a newline    and *globs*, and even a
'single' quote or two   .txt"

This file can be seen (better than ls) with this command:
for f in *; do echo "$f"; done

Then we can run this command:
for f in *; do rename 's/[*\n<|>"[\]]/ /g; s/\?//g; s/\\/ /g; s/ ,/,/g;
s/:/-/g; s/\s+/ /g; s/^\s*//; s/\s+\././g; '"s/'//g" "$f"; done

This results in a "clean" name, without potential incompatibilities, and no
leading space, as different from when this same command is executed via Dolphin
ServiceMenu.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the kfm-devel mailing list