Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
356 views
in Technique[技术] by (71.8m points)

regex - In Perl how to move folder in which folder name has junk letters?

How to move the folder, in which folder name containing junk characters. (ex:Theoretical Analysis_Ferda ?–zdemir S??nmez). Here there are some letters ? & ?). Please help me with this. Thanks in advance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use Win32::Unicode::Dir. For example:

use strict;
use warnings;
use utf8;
use Win32::Unicode::Console;
use Win32::Unicode::Dir ();

my $dir = 'S??nmez';
my $dest = 'temp';
Win32::Unicode::Dir::mkpathW($dest) or dieW "Could not create directory '$dest': $!";
Win32::Unicode::Dir::mvtreeW( "${dir}/", $dest) or dieW  "Cannot move '$dir' to '$dest': $!";
Win32::Unicode::Dir::rmdirW( $dir) or dieW "Cannot delete source directory name '$dir': $!";

See also How to delete folder with unicode character filenames using Perl rmtree?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...