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 8564993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:19:17+00:00 2026-06-11T17:19:17+00:00

I have a bunch of folder in my local hard disk. Below is the

  • 0

I have a bunch of folder in my local hard disk. Below is the folders name :

3 ABC
abc movie (2002)  HDTVRip  576p  Hindi  Eng  BHATTI87
Bcd [2011].720p.BRRip.x264.[Dual Audio] [Hindi+English].by K@rtik [ExD Exclusive]
def (2007)
Gaf-DVDRip-AVI
Gadks Of Wc (2012) - DVDRip - 1CD - XviD - Subs - [xDM]
Kah - DVDScr - XviD - 1CDRip - [DDR]
kaslf.kasl .Ljasj [2007] - x264 - AAC - 1 CD DVDRip - ESubs - MDG

I want all the name have some similarity like between each string there should be one space i.e “Gadks Of Wc (2012) – DVDRip – 1CD – XviD – Subs – [xDM]” should be
Gadks Of Wc (2012) DVDRip 1CD XviD Subs [xDM].

My logic was :

  1. Read the each folder name
  2. Store all the folder name in a list
  3. Do operation like split and join on each name

Below is my script :

#!/usr/bin/perl -w
use strict;

my $dir_name = "E:/movie";

opendir READ, $dir_name
    or die"Can not found it $!";

my @name = readdir(READ);
my (@split_name, $update_movie_name, $fix_movie_name);

foreach my $name (@name) {

   @split_name        = split /[\s+\/.\-]/,$name;
   $update_movie_name = movie_fun(@split_name); 
}

sub movie_fun {

    foreach my $movie (@split_name) {

        $fix_movie_name = join("",$movie);
    }

    return ($fix_movie_name);
}  

With this script I am only getting last part of the folder name. I don’t know where am I doing mistake. Please help me out of this problem. So that i can move my next step which will be deleting junk part from the name i.e “(2012) – DVDRip – 1CD – XviD – Subs – [xDM]”,(2007) etc

If any body can give me any other way to proceed for this problem then also will be fine.

Thanks

Thanks

  • 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-06-11T17:19:19+00:00Added an answer on June 11, 2026 at 5:19 pm
    #!/usr/bin/perl -w
    use strict;
    
    my $dir_name = "/movie";
    opendir READ, $dir_name
        or die"Can not found it $!";
    
    my @name = readdir(READ);
    
    FOLDER:
    foreach my $name (@name) {
    
        # process only directories (skip if folder name . or ..)
        next FOLDER if ( (not -d $dir_name.$name) || ($name =~ m{^\.+$}) );
    
        my @split_name  = split /[\s+\/.\-]/, $name;
        my $update_name = movie_fun(@split_name);
    
        printf "%s -> %s\n", $name, $update_name;
    }
    
    sub movie_fun {
        my @split_name = @_;
    
        return join '', @split_name;
    }
    

    OUTPUT

    3 ABC ->
    3ABC
    
    abc movie (2002)  HDTVRip  576p  Hindi  Eng  BHATTI87 ->
    abcmovie(2002)HDTVRip576pHindiEngBHATTI87
    
    Bcd [2011].720p.BRRip.x264.[Dual Audio] [Hindi+English].by K@rtik [ExD Exclusive] ->
    Bcd[2011]720pBRRipx264[DualAudio][HindiEnglish]byK@rtik[ExDExclusive]
    
    def (2007) -> 
    def(2007)
    
    Gaf-DVDRip-AVI ->
    GafDVDRipAVI
    
    Gadks Of Wc (2012) - DVDRip - 1CD - XviD - Subs - [xDM] ->
    GadksOfWc(2012)DVDRip1CDXviDSubs[xDM]
    
    Kah - DVDScr - XviD - 1CDRip - [DDR] ->
    KahDVDScrXviD1CDRip[DDR]
    
    kaslf.kasl .Ljasj [2007] - x264 - AAC - 1 CD DVDRip - ESubs - MDG ->
    kaslfkaslLjasj[2007]x264AAC1CDDVDRipESubsMDG
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my server, I have a bunch of archived folder name after the date:
I have a bunch of files in a folder checked out from a repository.
I have a bunch of images in a folder that are effectively just pieces
I have a bunch of .doc files in a folder which I need to
I have bunch of strings, some of which are fairly long, like so: movie.titles
I have a bunch of Views in a default folder that represent single static
I have a bunch of HTML files in HTML folder. Those HTML files have
I have a bunch of files and folders which I want versioned in svn.
I have a bunch of gzipped files in a folder where each line of
Suppose I have a bunch of files in a folder: foo.test.txt bar.txt ... And

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.