easiest way to delete backslash from file name
-
With the Perl-based file-rename:
$ rename --version /usr/bin/rename using File::Rename version 1.10
then using a
sed
-style regular expressions/pattern/replacement/
:$ rename -vn 's/\\//' \\*.txt rename(\jsandkjasn5.txt, jsandkjasn5.txt) rename(\jskadn.txt, jskadn.txt)
-
With
util-linux
rename (which takes simplepattern
replacement
arguments):$ rename.ul --version rename.ul from util-linux 2.34
then:
$ rename.ul -vn '\' '' \\*.txt `\jsandkjasn5.txt' -> `jsandkjasn5.txt' `\jskadn.txt' -> `jskadn.txt'
(you can use
\\
in place of'\'
if you prefer). Remove the-n
(no-op) switch once you are convinced they are doing the right thing. -
For completeness, using
mmv
:$ mmv -n '\\*' '#1' \jsandkjasn5.txt -> jsandkjasn5.txt \jskadn.txt -> jskadn.txt
-
Or a simple shell loop:
$ for f in \\*.txt; do echo mv "$f" "${f#?}"; done mv \jsandkjasn5.txt jsandkjasn5.txt mv \jskadn.txt jskadn.txt
(remove the
echo
in this case).