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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -