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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -