<?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: Copying the files in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039541#M93979</link>
    <description>&lt;!--!*#--&gt;Hi Vikram:&lt;BR /&gt;&lt;BR /&gt;The 'basename()' function (see the manpages) is your friend:&lt;BR /&gt;&lt;BR /&gt;cd /path&lt;BR /&gt;for F in `ls -1 *.cpp`&lt;BR /&gt;do&lt;BR /&gt;    cp -p `basename ${F} .cpp` `basename ${F} .cpp`.c&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 18 Jul 2007 09:06:51 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-07-18T09:06:51Z</dc:date>
    <item>
      <title>Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039537#M93975</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;   Can i know the command to copy all my *.cpp files to *.c files in one shot.&lt;BR /&gt;&lt;BR /&gt;    &lt;BR /&gt;thanks in advance&lt;BR /&gt;Vikram</description>
      <pubDate>Wed, 18 Jul 2007 07:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039537#M93975</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-07-18T07:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039538#M93976</link>
      <description>if the file are in the same directory you could do something like this:&lt;BR /&gt;&lt;BR /&gt;# for file in `ls *\.cpp`&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; mv $file $(echo $file | awk -F\. '{print $1}').c&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jul 2007 07:54:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039538#M93976</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2007-07-18T07:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039539#M93977</link>
      <description>Sorry, I wasn't looking close enough. You need to change mv to cp if you want to copy.</description>
      <pubDate>Wed, 18 Jul 2007 07:56:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039539#M93977</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2007-07-18T07:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039540#M93978</link>
      <description>And if you want to keep the same ownership and permissions, use cp -p&lt;BR /&gt;&lt;BR /&gt;Mark Syder (like the drink but spelt different)</description>
      <pubDate>Wed, 18 Jul 2007 08:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039540#M93978</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-07-18T08:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039541#M93979</link>
      <description>&lt;!--!*#--&gt;Hi Vikram:&lt;BR /&gt;&lt;BR /&gt;The 'basename()' function (see the manpages) is your friend:&lt;BR /&gt;&lt;BR /&gt;cd /path&lt;BR /&gt;for F in `ls -1 *.cpp`&lt;BR /&gt;do&lt;BR /&gt;    cp -p `basename ${F} .cpp` `basename ${F} .cpp`.c&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 18 Jul 2007 09:06:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039541#M93979</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-18T09:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039542#M93980</link>
      <description>&lt;!--!*#--&gt;Hi Vikram,&lt;BR /&gt;&lt;BR /&gt;This (quasi-tested) script operates on an entire directory structure:&lt;BR /&gt;&lt;BR /&gt;$ cat change_extension.sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;CMD=/usr/bin/cp&lt;BR /&gt;#CMD=/usr/bin/mv&lt;BR /&gt;&lt;BR /&gt;if [ ${#} -lt 3 ]&lt;BR /&gt;then&lt;BR /&gt;    echo "usage: ${0} &lt;PATH&gt; &lt;OLD extension=""&gt; &lt;NEW extension=""&gt;" &amp;gt;&amp;amp;2&lt;BR /&gt;    exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;FPATH=${1}&lt;BR /&gt;EXTO=${2}&lt;BR /&gt;EXTN=${3}&lt;BR /&gt;&lt;BR /&gt;find ${FPATH} -type f -name "*.${EXTO}" -print |\&lt;BR /&gt;while read L&lt;BR /&gt;do&lt;BR /&gt;    F=${L%.${EXTO}}&lt;BR /&gt;    ${CMD} ${L} ${F}.${EXTN}&lt;BR /&gt;done&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;$ ./change_extension.sh . cpp c&lt;BR /&gt;&lt;BR /&gt;PCS&lt;/NEW&gt;&lt;/OLD&gt;&lt;/PATH&gt;</description>
      <pubDate>Wed, 18 Jul 2007 09:15:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039542#M93980</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-07-18T09:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039543#M93981</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;another possibility:&lt;BR /&gt;ls *.cpp | sed 's/.cpp$//' | xargs -i cp -p '{}.cpp' '{}.c'&lt;BR /&gt;&lt;BR /&gt;You can drop the single quotes, if not running in a C-shell.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 19 Jul 2007 12:14:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039543#M93981</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-07-19T12:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039544#M93982</link>
      <description># ls -1 *.cpp | awk -F"cpp$" '{system("cp "$0" "$1"c")}'</description>
      <pubDate>Thu, 19 Jul 2007 13:38:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/copying-the-files/m-p/4039544#M93982</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-19T13:38:35Z</dc:date>
    </item>
  </channel>
</rss>

