Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1090323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:21:27+00:00 2026-05-16T23:21:27+00:00

I am trying to copy all files in one location to a different location

  • 0

I am trying to copy all files in one location to a different location and am using the File::Copy module and copy command from that, but now the issue I am facing is that I have file whose name has special character whose ascii value is &#253 but in unix file system it is stored as ? and so my question is that will copy or move command consider this files with special characters while copying or moving to another location or not,
if now then what would be an possible work around for this ?

Note: I cannot create file with special characters in unix because special characters are replaced with ? and I cannot do so in Windows because on Windows Special Characters are replaced with the Encoded value as in my case of &#253 ?

my $folderpath = 'the_path';
open my $IN, '<', 'path/to/infile';
my $total;
while (<$IN>) {
    chomp;
    my $size = -s "$folderpath/$_";
    print "$_ => $size\n";
    $total += $size;
}
print "Total => $total\n";

Courtesy: RickF Answer

Any suggesion would be highly appreciated.

Reference Question : Perl File Handling Question

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:21:27+00:00Added an answer on May 16, 2026 at 11:21 pm

    As workaround I can suggest to convert all unsupported characters to supported. This can be done in many ways. For example you can use URI::Escape:

    use URI::Escape;
    my $new_file_name = uri_escape($weird_file_name);
    

    Update:

    Here is how I was able to copy file by its uft-8 name. I’m on Windows. I’ve used Win32::GetANSIPathName to get short file name. Then it was copied nice:

    use File::Copy;
    use URI::Escape;
    use Win32;
    
    use utf8; ## tell perl that source code is in utf-9
    use strict;
    use warnings;
    
    my $test_file = "IBMýSoftware.txt";
    my $from_file = Win32::GetANSIPathName($test_file); ## get "short" name of file
    my $to_file   = uri_escape($test_file); ## name with special characters escaped
    
    printf("copy [%s] -> [%s]\n", $from_file, $to_file);
    copy($from_file, $to_file);
    

    After coping all file to new names on Windows, you’ll be able to work with them on linux without problems.

    Here are some hints about utf-8 file opening:

    • How do I create a Unicode directory on Windows using Perl?
    • With a utf8-encoded Perl script, can it open a filename encoded as GB2312?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to programming, trying to copy files from one location to another,
I'm trying to copy all the files from one directory to another, removing all
I am trying to create a program to copy all the files from one
I am trying to copy all format file (.txt,.pdf,.doc ...) file from source folder
I'm trying to copy some text to xml file. The problem is that all
So, all I'm trying to do is copy over every cell from one Excel
I am trying to copy files from a directory that is in constant use
I am trying to copy an SPListItem (with file) from one site collection to
What I am trying to do is copy files from one folder to another.
Using MongoDB I'm trying to copy a database from one server to another. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.