<?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: file renaming in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892509#M20779</link>
    <description>Ian,&lt;BR /&gt;&lt;BR /&gt;your script will not do much!!&lt;BR /&gt;&lt;BR /&gt;C=1&lt;BR /&gt;&lt;BR /&gt;If C is less than 10 go to end.....&lt;BR /&gt;which will very quickly be over, and nothing gets done  :-(&lt;BR /&gt;&lt;BR /&gt;This sure makes it easy for Hein to come up with something better!&lt;BR /&gt;&lt;BR /&gt;I guess you meant&lt;BR /&gt;$ IF C . GT. 10 THEN ...&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe&lt;BR /&gt;</description>
    <pubDate>Wed, 23 Mar 2005 11:04:44 GMT</pubDate>
    <dc:creator>Jan van den Ende</dc:creator>
    <dc:date>2005-03-23T11:04:44Z</dc:date>
    <item>
      <title>file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892506#M20776</link>
      <description>Hi, &lt;BR /&gt;I am new to OpenVMS and wanted to know if there is a simple way to rename files. I am aware of rename command however I have filenames increasing sequentially but in different folders &lt;BR /&gt;&lt;BR /&gt;e.g  dir1.subdir1.filename&lt;BR /&gt;dir2.subdir2.filename&lt;BR /&gt;dir3.subdir3.filename&lt;BR /&gt;&lt;BR /&gt;Can anyone please let me know how to rename the filenames with a simple script&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2005 10:20:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892506#M20776</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-03-23T10:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892507#M20777</link>
      <description>Can you give an example?&lt;BR /&gt;&lt;BR /&gt;you can do things with wildcarded renames otherwise a simpile loop in DCL &lt;BR /&gt;$C=1&lt;BR /&gt;$L1:&lt;BR /&gt;$ IF C .LT. 10 THEN GOTO END&lt;BR /&gt;$ RENAME [DIR'C'.SUBDIR'C']FILENAME NEWNAME&lt;BR /&gt;$ C = C+ 1&lt;BR /&gt;$ GOTO L1&lt;BR /&gt;$END:&lt;BR /&gt;&lt;BR /&gt;I expect Hein will come up with a solution in perl :-)</description>
      <pubDate>Wed, 23 Mar 2005 10:38:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892507#M20777</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2005-03-23T10:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892508#M20778</link>
      <description>Nipus,&lt;BR /&gt;&lt;BR /&gt;some simple examples:&lt;BR /&gt;&lt;BR /&gt;rename all files from [DIR.SUB] to [DIR]&lt;BR /&gt;(one level up)&lt;BR /&gt;$ RENA [DIR.SUB]*.*.* [DIR]&lt;BR /&gt;rename the highest version of each file:&lt;BR /&gt;$ RENA [DIR2.XYZ]*.*;0 [DIR3.ABC.DEF]&lt;BR /&gt;Renane alle files except those created todat:&lt;BR /&gt;$ RENA [X.Y]*.*.* [A.B.C]/BEFORE=TODAY&lt;BR /&gt;rename all files modified the last week:&lt;BR /&gt;$ RENA [A.B]*.*.* [C.D.E.F]/MODIFIED/SINC="TODAY-7-"&lt;BR /&gt;Rename all (but only the) .XYZ files:&lt;BR /&gt;$ RENA [P]*.XYZ.* [Q.R]&lt;BR /&gt;Rename all files with PQR somewhere in the filename:&lt;BR /&gt;RENA [X]*PQR*.*;* [Y.Z]&lt;BR /&gt;&lt;BR /&gt;If you have more complex needs, then in a DCL script just about anything can be accompliced. Tell us your need, and we will come up with an example solution.&lt;BR /&gt;&lt;BR /&gt;You can work out your own needs.&lt;BR /&gt;&lt;BR /&gt;Beware:&lt;BR /&gt;unlike UNIX, in VMS you can ONLY rename files to a location on THE SAME PHYSICAL DISK DRIVE!&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;Jan&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2005 11:00:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892508#M20778</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2005-03-23T11:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892509#M20779</link>
      <description>Ian,&lt;BR /&gt;&lt;BR /&gt;your script will not do much!!&lt;BR /&gt;&lt;BR /&gt;C=1&lt;BR /&gt;&lt;BR /&gt;If C is less than 10 go to end.....&lt;BR /&gt;which will very quickly be over, and nothing gets done  :-(&lt;BR /&gt;&lt;BR /&gt;This sure makes it easy for Hein to come up with something better!&lt;BR /&gt;&lt;BR /&gt;I guess you meant&lt;BR /&gt;$ IF C . GT. 10 THEN ...&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2005 11:04:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892509#M20779</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2005-03-23T11:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892510#M20780</link>
      <description>Jan, extra Duvel for you :-) &lt;BR /&gt;Just a typo.</description>
      <pubDate>Wed, 23 Mar 2005 11:33:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892510#M20780</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2005-03-23T11:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892511#M20781</link>
      <description>Thanks a lot for the replies. Giving you details is even better for me. &lt;BR /&gt;&lt;BR /&gt;I have two objectives 1) Rename files (*.ABC)&lt;BR /&gt;2) Move (*.TXT) files &lt;BR /&gt;&lt;BR /&gt;In both the scenario the directory setup is &lt;BR /&gt;as shown below. Right now I will go with first object, 2nd one I will post as new thread if required&lt;BR /&gt;&lt;BR /&gt;Please Note: these are two separate files in each directory with .GOBJ extension&lt;BR /&gt;&lt;BR /&gt;[00000760.00000427]C0000385.GOBJ  &lt;BR /&gt;[00000760.00000427]C0000385_TRAB.GOBJ    &lt;BR /&gt;&lt;BR /&gt;[00000761.00000428]C0000386.GOBJ&lt;BR /&gt;[00000761.00000428]C0000386_TRAB.GOBJ&lt;BR /&gt;&lt;BR /&gt;[00000763.00000429]C0000387.GOBJ&lt;BR /&gt;[00000763.00000429]C0000387_TRAB.GOBJ.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;Please observe the difference in numbers between 2nd and 3rd DIRECTORIES.... &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The following is the renaming&lt;BR /&gt;$RENAME C0000385.GOBJ C0000385_full.GOBJ &lt;BR /&gt;$RENAME C0000385_TRAB.GOBJ C0000385.GOBJ&lt;BR /&gt; &lt;BR /&gt;The following things are constant &lt;BR /&gt;1) No change in strings&lt;BR /&gt;2) The files are always located two subdirectories below as shown in the above example&lt;BR /&gt;3) File numbers can range from 0000000 to 999999 (right now we have files till 00008000)with a string before e.g C0000499.GOBJ&lt;BR /&gt;&lt;BR /&gt;My point is I am looking for 2 options in script that works like this &lt;BR /&gt;Option 1: Sequential Increase&lt;BR /&gt;&lt;BR /&gt;Enter your starting file number: 385 (this is directly the .Gobj file number shown above)&lt;BR /&gt;Enter you ending file number: 402 &lt;BR /&gt;&lt;BR /&gt;Option2: Non sequential increase&lt;BR /&gt;&lt;BR /&gt;In this scenarion I am thinking of preparing a txt file or editing the COM file and writing down each *.GOBJ number eg from which it can be read. &lt;BR /&gt;&lt;BR /&gt;$!enter the file names beow&lt;BR /&gt;335&lt;BR /&gt;345&lt;BR /&gt;402&lt;BR /&gt;454&lt;BR /&gt;$End&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;let me know your suggestions.</description>
      <pubDate>Wed, 23 Mar 2005 11:39:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892511#M20781</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-03-23T11:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892512#M20782</link>
      <description>The DCL RENAME command can not directly do what you want.&lt;BR /&gt;It can not morph a file name or extension. &lt;BR /&gt;&lt;BR /&gt;Here is a coarse outline with examples.&lt;BR /&gt;First in PERL, then in DCL.&lt;BR /&gt;&lt;BR /&gt;First create some test files:&lt;BR /&gt;&lt;BR /&gt;$ cr/dir [.tmp.a]&lt;BR /&gt;$ cr/dir [.tmp.b]&lt;BR /&gt;$ cr/dir [.tmp.c]&lt;BR /&gt;$ cop nl:    [.tmp.a]001.tmp&lt;BR /&gt;$ cop nl:    [.tmp.a]002.tmp&lt;BR /&gt;$ cop nl:    [.tmp.a]003.tmp&lt;BR /&gt;$ cop nl:    [.tmp.b]003.tmp&lt;BR /&gt;$ cop nl:    [.tmp.b]004.tmp&lt;BR /&gt;$ cop nl:    [.tmp.b]005.tmp&lt;BR /&gt;$ cop nl:    [.tmp.c]006.tmp&lt;BR /&gt;&lt;BR /&gt;List them in perl with a one-liner:&lt;BR /&gt;$ perl -e "print ""$_\n"" foreach (&amp;lt;[.tmp.*]*.tmp&amp;gt;)"&lt;BR /&gt;u$1:[hein.tmp.a]001.tmp&lt;BR /&gt;u$1:[hein.tmp.a]002.tmp&lt;BR /&gt;u$1:[hein.tmp.a]003.tmp&lt;BR /&gt;u$1:[hein.tmp.b]003.tmp&lt;BR /&gt;u$1:[hein.tmp.b]004.tmp&lt;BR /&gt;u$1:[hein.tmp.b]005.tmp&lt;BR /&gt;u$1:[hein.tmp.c]006.tmp&lt;BR /&gt;&lt;BR /&gt;Here is a perl one-liner for rename:&lt;BR /&gt;&lt;BR /&gt;perl -e "foreach (&amp;lt;[.tmp.*]*.tmp&amp;gt;){ if (/(.*)\.(.*)/) { rename $_,$1.""_xxx."".$2 }}"&lt;BR /&gt;&lt;BR /&gt;- the same 'glob' operation to find target files.&lt;BR /&gt;- then a regular expression to look for anytinng it can up to the last period (the * is greedy) remember that (in $1), and remember everything after that last period in $2.&lt;BR /&gt;- call rename with the file glob line ($_) as first argument, and a constructed second argument.&lt;BR /&gt;&lt;BR /&gt;You could readily tweak the glob file spec, or the regexpr to match exactly those files needed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now a DCL loop to get the files:&lt;BR /&gt;&lt;BR /&gt;$ cre tmp.com&lt;BR /&gt;$loop:&lt;BR /&gt;$file = f$search ("[.tmp.*]*.tmp")&lt;BR /&gt;$if file .eqs. "" then goto done&lt;BR /&gt;$write sys$output file&lt;BR /&gt;$goto loop&lt;BR /&gt;$done:&lt;BR /&gt; Exit&lt;BR /&gt;$ @tmp&lt;BR /&gt;U$1:[HEIN.TMP.A]001_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.A]002_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.A]003_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.B]003_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.B]004_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.B]005_XXX.TMP;1&lt;BR /&gt;U$1:[HEIN.TMP.C]006_XXX.TMP;1&lt;BR /&gt;&lt;BR /&gt;And a DCL loop to do similar renames:&lt;BR /&gt;&lt;BR /&gt;$ cre tmp.com&lt;BR /&gt;$loop:&lt;BR /&gt;$file = f$search ("[.tmp.*]*.tmp")&lt;BR /&gt;$if file .eqs. "" then goto done&lt;BR /&gt;$new_name = f$parse(file,,,"name") + "_yyy"&lt;BR /&gt;$rename/log 'file 'new_name&lt;BR /&gt;$goto loop&lt;BR /&gt;$done:&lt;BR /&gt; Exit&lt;BR /&gt;$ @tmp&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.A]001_XXX.TMP;1 renamed to U$1:[HEIN.TMP.A]001_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.A]002_XXX.TMP;1 renamed to U$1:[HEIN.TMP.A]002_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.A]003_XXX.TMP;1 renamed to U$1:[HEIN.TMP.A]003_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.B]003_XXX.TMP;1 renamed to U$1:[HEIN.TMP.B]003_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.B]004_XXX.TMP;1 renamed to U$1:[HEIN.TMP.B]004_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.B]005_XXX.TMP;1 renamed to U$1:[HEIN.TMP.B]005_XXX_YYY.TMP;1&lt;BR /&gt;%RENAME-I-RENAMED, U$1:[HEIN.TMP.C]006_XXX.TMP;1 renamed to U$1:[HEIN.TMP.C]006_XXX_YYY.TMP;1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2005 14:12:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892512#M20782</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-03-23T14:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892513#M20783</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I once wrote a little utility for 'enhanced' renaming, Heins example would be:&lt;BR /&gt;&lt;BR /&gt;$ xren &amp;lt;.%&amp;gt;%%%.tmp ()_YYY&lt;BR /&gt;&lt;BR /&gt;The help (XREN ?) is in german, but in the beginning are some english comments.&lt;BR /&gt;&lt;BR /&gt;mfg Kalle&lt;BR /&gt;&lt;BR /&gt;P.S. I renamed it to .COM_TXT.</description>
      <pubDate>Thu, 24 Mar 2005 01:10:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892513#M20783</guid>
      <dc:creator>Karl Rohwedder</dc:creator>
      <dc:date>2005-03-24T01:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892514#M20784</link>
      <description>Hein,&lt;BR /&gt;That was awesome. I got things running pretty well. Ofcourse, there are some modifications I still have to do. But that script pretty much did everything I need to know. &lt;BR /&gt;&lt;BR /&gt;The script by Ian was also very helpful for file renaming. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Mar 2005 13:51:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892514#M20784</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-03-24T13:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892515#M20785</link>
      <description>Thank you for the utility Karl,&lt;BR /&gt;I have already developed the file as per Hein's script and thereby also got better understanding of DCL programming. Your utility file will definetely be useful as a learning experience. &lt;BR /&gt;&lt;BR /&gt;nipun</description>
      <pubDate>Thu, 24 Mar 2005 21:35:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892515#M20785</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-03-24T21:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: file renaming</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892516#M20786</link>
      <description>thanks</description>
      <pubDate>Thu, 04 Aug 2005 14:24:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-renaming/m-p/4892516#M20786</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2005-08-04T14:24:40Z</dc:date>
    </item>
  </channel>
</rss>

