perl - Remove space from a filename -


i stuck @ finding answer question, made windows-cmd program , 1 of feature rename file. fine if theres no whitespace in old name / new name, long theres space doesn't work. i've been looking on how remove whitespaces both old , new names (if theres one), proceed rename , put whitespace i've no idea on how proceed.. i've been reading few things "trim" doesn't help. here part of code :

elsif ($fr eq 'ren') {         $getmenu =~ s/ren //g;         ($rf,$kb) = split /[ ]/,$getmenu;         rename($rf, $kb) || die "error\n";         print "\n>$rf has been renamed $kb\n";     } 

since white space character problem, would:

  1. replace them placeholder symbol (like hyphen, pipe, or @)
  2. rename file
  3. replace placeholder symbol spaces again

this question shows how that: replace whitespace hyphen in perl


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -