<?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: Mass renaming of directory tree using unique names in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936521#M410930</link>
    <description>Pete Randall's solution is the most elegant and per my requirment.&lt;BR /&gt;Thanks Pete.</description>
    <pubDate>Wed, 26 Oct 2005 13:03:37 GMT</pubDate>
    <dc:creator>Ron Barak</dc:creator>
    <dc:date>2005-10-26T13:03:37Z</dc:date>
    <item>
      <title>Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936512#M410921</link>
      <description>Hi Gurus,&lt;BR /&gt;&lt;BR /&gt;The problem: &lt;BR /&gt;I have a directory tree, filled with JPEG files. &lt;BR /&gt;I would like to rename all these jpegs using unique numerical names - say starting at `date +"%Y%m%d%H%M%S"` and making sure that at least one second passes before the next rename operation.&lt;BR /&gt;&lt;BR /&gt;The Request: &lt;BR /&gt;Can you suggest a way to do this _without_ writing a script, namely, from the shell command line ?&lt;BR /&gt;&lt;BR /&gt;My non-working solution:&lt;BR /&gt;$ find . -type f -name "*jpg" -exec cp {} ../results/`date +"%Y%m%d%H%M%S"`.jpg \; -exec sleep 1 \;&lt;BR /&gt;&lt;BR /&gt;My problem is that find seems to optimize the operation, and calculates date +"%Y%m%d%H%M%S" only once (thus, all the files are copied to one name). &lt;BR /&gt;&lt;BR /&gt;Conclusion: &lt;BR /&gt;If you could suggest a way to make the date command to re-calculate for each file renaming, it'd solve the problem.&lt;BR /&gt;Of course, full points will be given to shell-command-line solutions other than using find (Perl/sed/awk one-liners are welcome).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ron.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Oct 2005 06:51:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936512#M410921</guid>
      <dc:creator>Ron Barak</dc:creator>
      <dc:date>2005-10-26T06:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936513#M410922</link>
      <description>I think that you need a for cycle, so the date is recalculated:&lt;BR /&gt;&lt;BR /&gt;for FILE in `ls $1`; do&lt;BR /&gt;cp $FILE ../results/`date +"%Y%m%d%H%M%S"`.jpg &lt;BR /&gt;sleep 1&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Oct 2005 07:00:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936513#M410922</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-10-26T07:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936514#M410923</link>
      <description>Or:&lt;BR /&gt;&lt;BR /&gt;for FILE in "*.jpg"&lt;BR /&gt;do&lt;BR /&gt;cp $FILE ../results/`date +"%Y%m%d%H%M%S"`.jpg&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 26 Oct 2005 07:06:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936514#M410923</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-10-26T07:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936515#M410924</link>
      <description>Hi Ivan,&lt;BR /&gt;As I said, I need to rename files in a directory _tree_: I don't think your solution will be able to solve that (it doesn't descend to subdirectories).&lt;BR /&gt;Bye,&lt;BR /&gt;Ron.</description>
      <pubDate>Wed, 26 Oct 2005 07:11:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936515#M410924</guid>
      <dc:creator>Ron Barak</dc:creator>
      <dc:date>2005-10-26T07:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936516#M410925</link>
      <description>You can use sleep to pause for a while and do the renaming again in a loop. It should definitely help. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Wed, 26 Oct 2005 07:11:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936516#M410925</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-10-26T07:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936517#M410926</link>
      <description>Ron,&lt;BR /&gt;&lt;BR /&gt;Maybe something like this then:&lt;BR /&gt;&lt;BR /&gt;for FILE in `find . -type f -name "*.jpg"`&lt;BR /&gt;do&lt;BR /&gt;cp  $FILE /results/`date +"%Y%m%d%H%M%S"`.jpg&lt;BR /&gt;sleep 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 26 Oct 2005 07:15:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936517#M410926</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-10-26T07:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936518#M410927</link>
      <description>Simply by adding ls -R to the script should work. But also, the script above do the job.</description>
      <pubDate>Wed, 26 Oct 2005 07:23:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936518#M410927</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-10-26T07:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936519#M410928</link>
      <description>Hi Ron:&lt;BR /&gt;&lt;BR /&gt;You can easily do what you want by pushing the '-exec' arguments into a small script snippet:&lt;BR /&gt;&lt;BR /&gt;#cat /tmp/myexec&lt;BR /&gt;cp $1 ../results/`date +"%Y%m%d%H%M%S"`.jpg &lt;BR /&gt;sleep 1&lt;BR /&gt;&lt;BR /&gt;...Now do:&lt;BR /&gt;&lt;BR /&gt;# find . -type f -name "*jpg" -exec /tmp/myexec {} \;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 26 Oct 2005 07:40:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936519#M410928</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-10-26T07:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936520#M410929</link>
      <description>If you're just looking for an aproach to copy files to unique names with or w/out using date and sleep to create the unique name for each, you could use a variable or some combo w/ a variable incremented... etc. could be a little more flexible w/ file names. I know you weren't looking for a script, but one way to do it w/ out much effort was in a loop.&lt;BR /&gt;&lt;BR /&gt;VAR=0&lt;BR /&gt;BASE=`date +"%Y%m%d`&lt;BR /&gt;for JPG in `find ./path -name "*.jpg"`&lt;BR /&gt;do&lt;BR /&gt;cp -p $JPG ./newpath/${BASE}-${VAR}.jpg&lt;BR /&gt;VAR=$((VAR + 1))&lt;BR /&gt;done</description>
      <pubDate>Wed, 26 Oct 2005 07:43:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936520#M410929</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2005-10-26T07:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Mass renaming of directory tree using unique names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936521#M410930</link>
      <description>Pete Randall's solution is the most elegant and per my requirment.&lt;BR /&gt;Thanks Pete.</description>
      <pubDate>Wed, 26 Oct 2005 13:03:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mass-renaming-of-directory-tree-using-unique-names/m-p/4936521#M410930</guid>
      <dc:creator>Ron Barak</dc:creator>
      <dc:date>2005-10-26T13:03:37Z</dc:date>
    </item>
  </channel>
</rss>

