<?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 rename files script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434563#M707445</link>
    <description>I have hundreds of files that I would like to rename to such as 2004010000 - 2004010999.&lt;BR /&gt;these file names have spcaces in them such as xxx 01 xx 02.dat&lt;BR /&gt;&lt;BR /&gt;what would be a script that i can use that will achieve that?&lt;BR /&gt;&lt;BR /&gt;thanks for the help in advance.</description>
    <pubDate>Wed, 01 Dec 2004 18:37:28 GMT</pubDate>
    <dc:creator>walid salah faroun</dc:creator>
    <dc:date>2004-12-01T18:37:28Z</dc:date>
    <item>
      <title>rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434563#M707445</link>
      <description>I have hundreds of files that I would like to rename to such as 2004010000 - 2004010999.&lt;BR /&gt;these file names have spcaces in them such as xxx 01 xx 02.dat&lt;BR /&gt;&lt;BR /&gt;what would be a script that i can use that will achieve that?&lt;BR /&gt;&lt;BR /&gt;thanks for the help in advance.</description>
      <pubDate>Wed, 01 Dec 2004 18:37:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434563#M707445</guid>
      <dc:creator>walid salah faroun</dc:creator>
      <dc:date>2004-12-01T18:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434564#M707446</link>
      <description>You need to be much more specific about what you want the rename patterns to be. For example, is there only I file that contains "01" and should it become the 2004040001 file. Are all the files in the same directory? Do all the files start with "xx"? The spaces are not a problem. Spaces are legal (if dumb) UNIX pathname characters but should be avoided because most scripts assume no whitespace. In your case, it just means that careful attention must be paid to quoting.&lt;BR /&gt;&lt;BR /&gt;Give 5 or 6 very specific examples and this should be fairly easy -- especially in Perl but also in the shell.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 18:53:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434564#M707446</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-12-01T18:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434565#M707447</link>
      <description>thanks for you quick replay;&lt;BR /&gt;here is a list of some files:&lt;BR /&gt;2004-SEP-04_02-43-22_  0.DAT  &lt;BR /&gt;2004-SEP-04_03-18-44_ 34.DAT&lt;BR /&gt;2004-SEP-04_02-44-24_  1.DAT  &lt;BR /&gt;2004-SEP-04_03-19-44_ 35.DAT&lt;BR /&gt;2004-SEP-04_02-45-28_  2.DAT  &lt;BR /&gt;2004-SEP-04_03-20-44_ 36.DAT&lt;BR /&gt;2004-SEP-04_02-46-31_  3.DAT  &lt;BR /&gt;2004-SEP-04_03-21-44_ 37.DAT&lt;BR /&gt;&lt;BR /&gt;so what I would like to do is rename all files such as 2004120001 through 2004129999.&lt;BR /&gt;file pattern is yyyymm0001 - yyyymm9999.&lt;BR /&gt;thanks again for the help.</description>
      <pubDate>Wed, 01 Dec 2004 19:12:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434565#M707447</guid>
      <dc:creator>walid salah faroun</dc:creator>
      <dc:date>2004-12-01T19:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434566#M707448</link>
      <description>This still isn't enough to work with. You've now listed some input patterns (but I don't see any spaces so include those examples) but what is missing are the desired output names.&lt;BR /&gt;&lt;BR /&gt;File111_xxx.DAT --&amp;gt; 2004120111&lt;BR /&gt;File112_ DAT --&amp;gt; 2004120012&lt;BR /&gt;&lt;BR /&gt;or whatever.</description>
      <pubDate>Wed, 01 Dec 2004 19:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434566#M707448</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-12-01T19:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434567#M707449</link>
      <description>the space is after the second underscore &lt;BR /&gt;"2004-SEP-04_02-43-22_  0.DAT"&lt;BR /&gt;the desired output is such as&lt;BR /&gt;20041200001 through 2004129999&lt;BR /&gt;or really depending on how namy files I have in the directory.&lt;BR /&gt;&lt;BR /&gt;thanks again.</description>
      <pubDate>Wed, 01 Dec 2004 19:26:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434567#M707449</guid>
      <dc:creator>walid salah faroun</dc:creator>
      <dc:date>2004-12-01T19:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: rename files script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434568#M707450</link>
      <description>Okay this is pretty easy; I'm going to suggest that you copy these files to another directory and then remove the originals and then you mv the copies to the original directory. This will give you a method of fixing any problems while you perfect your script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset DESTDIR=/xxx/yyy&lt;BR /&gt;&lt;BR /&gt;if [[ ! -d ${DESTDIR} ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Copy directory ${DESTDIR} not found" &amp;gt;&amp;amp;2&lt;BR /&gt;    exit 255&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;typeset -i I=0&lt;BR /&gt;typeset -Z4 Z=0&lt;BR /&gt;typeset DESTNAME=""&lt;BR /&gt;ls | while read X&lt;BR /&gt;  do&lt;BR /&gt;     Z=${I}&lt;BR /&gt;     DESTNAME="${DESTDIR}/200412${Z}"&lt;BR /&gt;     echo "File \"${X}\" --&amp;gt; \"${DESTNAME}\""&lt;BR /&gt;#    cp "${X}" "${DESTNAME}" &lt;BR /&gt;#    leave above line commented while testing&lt;BR /&gt;     ((I += 1))&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;-------------------------&lt;BR /&gt;This should be very close.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 19:57:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rename-files-script/m-p/3434568#M707450</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-12-01T19:57:52Z</dc:date>
    </item>
  </channel>
</rss>

