<?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: Using * doesn't copy all files. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672287#M243952</link>
    <description>It's important to understand that filenames that start with a . (period) are "hidden" files as far as Unix shells are concerned. So the * all by itself will *not* match filenames like .profile and .exrc because they are hidden. You will see this in the ls command but you can override this with the ls -a option (see: man ls).&lt;BR /&gt; &lt;BR /&gt;Now be VERY careful about using various incantations of the . and the * as these filename matching options can have unexpected consequences. Whenever I am in doubt about using filename matching characters, I will put the word "echo" in front of the command to see what will actually happen. Something like this:&lt;BR /&gt; &lt;BR /&gt;echo cp /home/user/*.&lt;BR /&gt; &lt;BR /&gt;This is especially important if you are removing files (rm). You might be tempted to use .* which will match filenames that start with a dot followed by zero or more characters. This is very important: there are two files that sysadmins often forget about: these are . and .. which are special files called directories. These are the current directory and the parent directory. To see what .* matches, just do this:&lt;BR /&gt; &lt;BR /&gt;echo /home/user/.*&lt;BR /&gt; &lt;BR /&gt;You'll see a huge number of files and directories because .. was matched and you are seeing /home contents. You can imagine the disaster that would happen if you typed: rm -rf /home/user/.* (every file and directory in /home will be removed).&lt;BR /&gt; &lt;BR /&gt;cp (and commands like rm mv ls) do not know anything special about *. This (and other special characters) are pattern matching characters used by the shell to expand into matching filenames. That's why using the echo command in front of a command line with filename patterns is so useful. To see this at work:&lt;BR /&gt; &lt;BR /&gt;echo '*'&lt;BR /&gt;echo *&lt;BR /&gt; &lt;BR /&gt;The first returns a * because the single quotes remove the special meaning of * while the second line asks the shell to replace * with a set of matching filenames.&lt;BR /&gt; &lt;BR /&gt;An easy to remember incantation to pickup the . files (without picking the parent directories with .*) is to use .??* which means: matching filenames must start with a dot, followed by at least 2 additional characters. This prevents .. from matching (it's only 2 chars and the mask requires 3 or more). But this mask will miss files like .1 .2 .a .b and so on.&lt;BR /&gt; &lt;BR /&gt;After all this, you can use the -r option for cp and eliminate any filename matching problems:&lt;BR /&gt; &lt;BR /&gt;cp -r /home/user /someplace_else&lt;BR /&gt;</description>
    <pubDate>Tue, 15 Nov 2005 19:02:28 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2005-11-15T19:02:28Z</dc:date>
    <item>
      <title>Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672284#M243949</link>
      <description>I'm about to rip out my hair on this one.  I have a large number of files that I must copy multiple times and they all start with . (i.e. .profile) but when I type:&lt;BR /&gt;&lt;BR /&gt;cp /home/user/*&lt;BR /&gt;&lt;BR /&gt;I get:&lt;BR /&gt;cp: cannot access /home/user/*: No such file or directory&lt;BR /&gt;&lt;BR /&gt;Even though I know the files are there.  I have tried substituting *.* and .* to no avail, they both give the same message.  Is there any way to pick up all of these files using a single command?</description>
      <pubDate>Tue, 15 Nov 2005 16:41:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672284#M243949</guid>
      <dc:creator>Jonathan Taylor_3</dc:creator>
      <dc:date>2005-11-15T16:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672285#M243950</link>
      <description>Safest way to do this is:&lt;BR /&gt;&lt;BR /&gt;cp /home/user/.[A-Za-z]* destination_path&lt;BR /&gt;&lt;BR /&gt;If you only put .*, it will try to grab . and .. also and give you error s about needing the -R option. Of course, if you have directory names that are hidden (named .something) that you want copied too, you need the -R option anyway.</description>
      <pubDate>Tue, 15 Nov 2005 17:01:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672285#M243950</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2005-11-15T17:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672286#M243951</link>
      <description>Thanks, that took care of it.</description>
      <pubDate>Tue, 15 Nov 2005 17:38:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672286#M243951</guid>
      <dc:creator>Jonathan Taylor_3</dc:creator>
      <dc:date>2005-11-15T17:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672287#M243952</link>
      <description>It's important to understand that filenames that start with a . (period) are "hidden" files as far as Unix shells are concerned. So the * all by itself will *not* match filenames like .profile and .exrc because they are hidden. You will see this in the ls command but you can override this with the ls -a option (see: man ls).&lt;BR /&gt; &lt;BR /&gt;Now be VERY careful about using various incantations of the . and the * as these filename matching options can have unexpected consequences. Whenever I am in doubt about using filename matching characters, I will put the word "echo" in front of the command to see what will actually happen. Something like this:&lt;BR /&gt; &lt;BR /&gt;echo cp /home/user/*.&lt;BR /&gt; &lt;BR /&gt;This is especially important if you are removing files (rm). You might be tempted to use .* which will match filenames that start with a dot followed by zero or more characters. This is very important: there are two files that sysadmins often forget about: these are . and .. which are special files called directories. These are the current directory and the parent directory. To see what .* matches, just do this:&lt;BR /&gt; &lt;BR /&gt;echo /home/user/.*&lt;BR /&gt; &lt;BR /&gt;You'll see a huge number of files and directories because .. was matched and you are seeing /home contents. You can imagine the disaster that would happen if you typed: rm -rf /home/user/.* (every file and directory in /home will be removed).&lt;BR /&gt; &lt;BR /&gt;cp (and commands like rm mv ls) do not know anything special about *. This (and other special characters) are pattern matching characters used by the shell to expand into matching filenames. That's why using the echo command in front of a command line with filename patterns is so useful. To see this at work:&lt;BR /&gt; &lt;BR /&gt;echo '*'&lt;BR /&gt;echo *&lt;BR /&gt; &lt;BR /&gt;The first returns a * because the single quotes remove the special meaning of * while the second line asks the shell to replace * with a set of matching filenames.&lt;BR /&gt; &lt;BR /&gt;An easy to remember incantation to pickup the . files (without picking the parent directories with .*) is to use .??* which means: matching filenames must start with a dot, followed by at least 2 additional characters. This prevents .. from matching (it's only 2 chars and the mask requires 3 or more). But this mask will miss files like .1 .2 .a .b and so on.&lt;BR /&gt; &lt;BR /&gt;After all this, you can use the -r option for cp and eliminate any filename matching problems:&lt;BR /&gt; &lt;BR /&gt;cp -r /home/user /someplace_else&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Nov 2005 19:02:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672287#M243952</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-11-15T19:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672288#M243953</link>
      <description>Hi Jonathan,&lt;BR /&gt;&lt;BR /&gt;you can try with tar:&lt;BR /&gt;&lt;BR /&gt; cd fromdir ; tar cf - . | ( cd todir ; tar xf - )&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Borislav</description>
      <pubDate>Wed, 16 Nov 2005 04:50:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672288#M243953</guid>
      <dc:creator>Borislav Perkov</dc:creator>
      <dc:date>2005-11-16T04:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672289#M243954</link>
      <description>Hi..&lt;BR /&gt;&lt;BR /&gt;fistly, You have to login root user&lt;BR /&gt;&lt;BR /&gt;#cp -rp /home/user/. {/destnation dir}&lt;BR /&gt;&lt;BR /&gt;good luck~&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Nov 2005 04:57:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672289#M243954</guid>
      <dc:creator>원유광</dc:creator>
      <dc:date>2005-11-16T04:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672290#M243955</link>
      <description>If you want to copy only the files in /home/user/ directory then,&lt;BR /&gt;&lt;BR /&gt;find /home/user -type f -exec cp {} &lt;DIRECTORY&gt; \;&lt;BR /&gt;&lt;BR /&gt;It will do.&lt;BR /&gt;&lt;BR /&gt;cp /home/user/[A-Za-z]* will also require -R when you are having directory there in /home/user/&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/DIRECTORY&gt;</description>
      <pubDate>Wed, 16 Nov 2005 05:16:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672290#M243955</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-16T05:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672291#M243956</link>
      <description>For the group:  Is there any advantage (or dis-) to using something like&lt;BR /&gt;&lt;BR /&gt;for f in $(ls -a /home/user/)&lt;BR /&gt;do&lt;BR /&gt;  cp $f Destination&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I probably would have forgotten the -a but for this thread, and in trying it out, it looks like you also need -R if there are subdirectories.&lt;BR /&gt;&lt;BR /&gt;If there's a really large number of files, is there a limit to the number of characters that * can expand into?&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Nov 2005 14:07:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672291#M243956</guid>
      <dc:creator>Michael D. Zorn</dc:creator>
      <dc:date>2005-11-16T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672292#M243957</link>
      <description>Here is what I do to copy all file.&lt;BR /&gt;&lt;BR /&gt;find /home/user -print | cpio -pvmud /target_dir&lt;BR /&gt;&lt;BR /&gt;To get just the ones that start with "."&lt;BR /&gt;&lt;BR /&gt;find /home/user -name ".*" -print | cpio -pvmud /target_dir&lt;BR /&gt;&lt;BR /&gt;This method includes subdirectories and will create said subdirectory structure under the target dir.&lt;BR /&gt;&lt;BR /&gt;wayne&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Nov 2005 14:45:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672292#M243957</guid>
      <dc:creator>Wayne Patton_1</dc:creator>
      <dc:date>2005-11-16T14:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using * doesn't copy all files.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672293#M243958</link>
      <description>if that directory only contains '.' files and all of them need to be copied, you can also just reference to the directory and it will copy everything including hidden files.&lt;BR /&gt;&lt;BR /&gt;so instead of '/home/user/*' you use '/home/user', at least with GNU-cp this works.</description>
      <pubDate>Mon, 21 Nov 2005 08:03:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-doesn-t-copy-all-files/m-p/3672293#M243958</guid>
      <dc:creator>dirk dierickx</dc:creator>
      <dc:date>2005-11-21T08:03:24Z</dc:date>
    </item>
  </channel>
</rss>

