<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: rename script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434612#M206341</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;cd /mydir&lt;BR /&gt;NUMBER=100&lt;BR /&gt;for file_name in `ls`&lt;BR /&gt;do&lt;BR /&gt;  endname=`echo $file_name|cut -d'.' -f2`&lt;BR /&gt;  mv $file_name "$NUMBER.$endname" &lt;BR /&gt;  NUMBER=`expr $NUMBER + 1`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Be sure what no directory is present in /mydir else you must to add test if file_name is a directory or not before rename it&lt;BR /&gt; &lt;BR /&gt;Rgds &lt;BR /&gt;JMB</description>
    <pubDate>Thu, 02 Dec 2004 10:59:32 GMT</pubDate>
    <dc:creator>BONNAFOUS Jean Marc</dc:creator>
    <dc:date>2004-12-02T10:59:32Z</dc:date>
    <item>
      <title>rename script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434610#M206339</link>
      <description>Hi,&lt;BR /&gt;it's help call rather than a question, I trying to write a script that will rename all files in given /mydir/ into inremented by +1 numeric name. Like&lt;BR /&gt;file012.dat   101.dat&lt;BR /&gt;file333.dat   102.dat&lt;BR /&gt;file4.xls     103.xls&lt;BR /&gt;&lt;BR /&gt;I'm on HPUX, thoug probably I will need to run this on PC (after installing Perl) or just under DOS??&lt;BR /&gt;&lt;BR /&gt;Thanks all&lt;BR /&gt;Dai&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 19:37:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434610#M206339</guid>
      <dc:creator>Vlad_11</dc:creator>
      <dc:date>2004-12-01T19:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: rename script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434611#M206340</link>
      <description>Here is a ksh script that should work. It goes through all the files in a directory and creates a "mv" statement to rename. &lt;BR /&gt; &lt;BR /&gt;I prefer a script that creates another script so that it gives me a chance to review the "mv" commands.&lt;BR /&gt; &lt;BR /&gt;I also recommend moving the files to another directory. If you move into the same directory you have the potential of renaming a file to a name that already exists.&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;typeset -Z3 cnt=0&lt;BR /&gt;cd /your/path&lt;BR /&gt;ls -1 &amp;gt;/tmp/files&lt;BR /&gt;while read line ; do&lt;BR /&gt; let "cnt = cnt + 1"&lt;BR /&gt; echo "mv '$line' '../newloc/${cnt}.${line##*.}'"&lt;BR /&gt;done /tmp/moveit&lt;BR /&gt; &lt;BR /&gt;File /tmp/moveit will be a list of "mv" commands. Enter "sh /tmp/moveit" to run.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Dec 2004 10:59:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434611#M206340</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-12-02T10:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: rename script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434612#M206341</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;cd /mydir&lt;BR /&gt;NUMBER=100&lt;BR /&gt;for file_name in `ls`&lt;BR /&gt;do&lt;BR /&gt;  endname=`echo $file_name|cut -d'.' -f2`&lt;BR /&gt;  mv $file_name "$NUMBER.$endname" &lt;BR /&gt;  NUMBER=`expr $NUMBER + 1`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Be sure what no directory is present in /mydir else you must to add test if file_name is a directory or not before rename it&lt;BR /&gt; &lt;BR /&gt;Rgds &lt;BR /&gt;JMB</description>
      <pubDate>Thu, 02 Dec 2004 10:59:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-script/m-p/3434612#M206341</guid>
      <dc:creator>BONNAFOUS Jean Marc</dc:creator>
      <dc:date>2004-12-02T10:59:32Z</dc:date>
    </item>
  </channel>
</rss>

