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
Asked
Active
Viewed 74 times
-1
-
What OS? What encoding do you use on the file system? Does your Perl script use [utf8](http://p3rl.org/utf8)? – choroba Jan 12 '21 at 08:54
-
Yes i used utf8, OS is windows – Suhima K Jan 12 '21 at 10:10
-
https://stackoverflow.com/q/1721807/1030675 might help you. – choroba Jan 12 '21 at 10:52
-
Still I didn't get an output for this question. Anybody please help me – Suhima K Jan 13 '21 at 05:17
1 Answers
0
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?

Håkon Hægland
- 39,012
- 21
- 81
- 174