<?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 file renames - in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870105#M707124</link>
    <description>I have a vendor process that creates output with random file names,&lt;BR /&gt;I am wanting to put some organization to it, consolidating this stuff into &lt;BR /&gt;one location after it's been used. I've have problems in the past with duplicate&lt;BR /&gt;files names, I think I may be on to a creation but want to run it by the scripts &lt;BR /&gt;gurus. &lt;BR /&gt;&lt;BR /&gt;Here is what I am thinking, see if I am full of it. &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;for fn1 in `ls -la |awk '{print $4}' &lt;BR /&gt;do &lt;BR /&gt;export fn2=`date +%Y%j%H%M%S`$fn1.ext &lt;BR /&gt;mv $fn1 $fn2 &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;By doing this I am retaining the original name in the file name, but, creating a uniq file based on the "date stamp"&lt;BR /&gt;&lt;BR /&gt;Anyone with a better way? or suggestions appreciated. &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 11 Nov 2004 13:42:59 GMT</pubDate>
    <dc:creator>rmueller58</dc:creator>
    <dc:date>2004-11-11T13:42:59Z</dc:date>
    <item>
      <title>file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870105#M707124</link>
      <description>I have a vendor process that creates output with random file names,&lt;BR /&gt;I am wanting to put some organization to it, consolidating this stuff into &lt;BR /&gt;one location after it's been used. I've have problems in the past with duplicate&lt;BR /&gt;files names, I think I may be on to a creation but want to run it by the scripts &lt;BR /&gt;gurus. &lt;BR /&gt;&lt;BR /&gt;Here is what I am thinking, see if I am full of it. &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;for fn1 in `ls -la |awk '{print $4}' &lt;BR /&gt;do &lt;BR /&gt;export fn2=`date +%Y%j%H%M%S`$fn1.ext &lt;BR /&gt;mv $fn1 $fn2 &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;By doing this I am retaining the original name in the file name, but, creating a uniq file based on the "date stamp"&lt;BR /&gt;&lt;BR /&gt;Anyone with a better way? or suggestions appreciated. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2004 13:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870105#M707124</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T13:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870106#M707125</link>
      <description>You are doing right. you may want to add $$ (shell pid) to the file name.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Thu, 11 Nov 2004 13:52:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870106#M707125</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-11-11T13:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870107#M707126</link>
      <description>Seems reasonably OK to me - only point I'd make is that if you have a LOT of files, you might blow out the max number of arguments useable by the shell (256 I think?). Also I don't think you want to include directories which ls -a will show ( and straight ls if this is run as root). A better way might be:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;find . -type f | while read fn1&lt;BR /&gt;do &lt;BR /&gt;export fn2=$(date +%Y%j%H%M%S)${fn1}.ext &lt;BR /&gt;mv ${fn1} ${fn2} &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;This would mean being careful about subdirectories though.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Thu, 11 Nov 2004 13:56:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870107#M707126</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2004-11-11T13:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870108#M707127</link>
      <description>I can see I will need to make a copy of some sacrificial files.. Whoa!! &lt;BR /&gt;&lt;BR /&gt;Thanks for the PID idea.</description>
      <pubDate>Thu, 11 Nov 2004 13:57:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870108#M707127</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T13:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870109#M707128</link>
      <description>Duncan, &lt;BR /&gt;&lt;BR /&gt;The file they build has an extension of ".saf"  I was thinking to avoid the directories" i'd change my ls -la to add &lt;BR /&gt;ls -la *.saf &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2004 14:01:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870109#M707128</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T14:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870110#M707129</link>
      <description>Found a problem, several of the files have spaces in the file name. God I hate vendors and users that follow no programming consistency.&lt;BR /&gt;&lt;BR /&gt;Brother. &lt;BR /&gt;&lt;BR /&gt;Several of the file were named like:&lt;BR /&gt;&lt;BR /&gt;November balance sheet.saf&lt;BR /&gt;September 10 posting.saf &lt;BR /&gt;&lt;BR /&gt;ARGGH!! &lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2004 14:05:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870110#M707129</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T14:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870111#M707130</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Instead of 'for' try 'while'. In case if the filenames have spaces in them, 'for' wont' work&lt;BR /&gt;&lt;BR /&gt;ls -1 | while read&lt;BR /&gt;do&lt;BR /&gt;&lt;DO your="" stuff="" here=""&gt;&lt;BR /&gt;mv "$fn1" "$fn2"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;/DO&gt;</description>
      <pubDate>Thu, 11 Nov 2004 14:13:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870111#M707130</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-11-11T14:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870112#M707131</link>
      <description>Geezz.. it's me..&lt;BR /&gt;&lt;BR /&gt;ls -1 | while read&lt;BR /&gt;&lt;BR /&gt;should have been &lt;BR /&gt;&lt;BR /&gt;ls -1 | while read fn1&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 11 Nov 2004 14:15:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870112#M707131</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-11-11T14:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870113#M707133</link>
      <description>Thanks Sri. I will change the for loop for a while statement.</description>
      <pubDate>Thu, 11 Nov 2004 14:27:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870113#M707133</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T14:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: file renames -</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870114#M707135</link>
      <description>Thanks guys..</description>
      <pubDate>Thu, 11 Nov 2004 14:39:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-renames/m-p/4870114#M707135</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-11-11T14:39:42Z</dc:date>
    </item>
  </channel>
</rss>

