<?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: Help regarding a shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998131#M47618</link>
    <description>Thanks....&lt;BR /&gt;&lt;BR /&gt;As you suggested...I also did the same thing but removed the "sed" portion from it....&lt;BR /&gt;&lt;BR /&gt;Mine looks like dis.....&lt;BR /&gt;&lt;BR /&gt;DURATION=7&lt;BR /&gt;BACKUP=/tmp/ftp&lt;BR /&gt;HOME_DIR=/home/ftp&lt;BR /&gt;&lt;BR /&gt;for file in [ `find $HOME_DIR -mtime +$DURATION` ]&lt;BR /&gt;do&lt;BR /&gt;        cp -rf -p $file $BACKUP&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank u vereeeee much for your valuable help....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Atul</description>
    <pubDate>Fri, 18 Aug 2006 06:38:51 GMT</pubDate>
    <dc:creator>Atul Gautam</dc:creator>
    <dc:date>2006-08-18T06:38:51Z</dc:date>
    <item>
      <title>Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998126#M47613</link>
      <description>Hi Xperts,&lt;BR /&gt;&lt;BR /&gt;I have got a dir structure in my home dir for FTP users which is ---&lt;BR /&gt;&lt;BR /&gt;                /home&lt;BR /&gt;                   |&lt;BR /&gt;                 /ftp&lt;BR /&gt;                   |&lt;BR /&gt;    -------------USERS---------------&lt;BR /&gt;    |      |     |     |      |     |&lt;BR /&gt;    A      B     C     D      E     F        |&lt;BR /&gt;    |&lt;BR /&gt;    |-/2006 - /Month - /Date - /1   &amp;amp;    /2 &lt;BR /&gt;    |                           |         |&lt;BR /&gt;    |                        /a &amp;amp; /b   /a &amp;amp; /b&lt;BR /&gt;    |&lt;BR /&gt;    |&lt;BR /&gt;    |-/2007 - /Month - /Date - /1   &amp;amp;   /2 &lt;BR /&gt;                                |        |&lt;BR /&gt;                             /a &amp;amp; /b  /a &amp;amp; /b&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The dir structure present under A is replicated under every user's home directory.&lt;BR /&gt;&lt;BR /&gt;What I want is ---&lt;BR /&gt;FILES MODIFIED 7 OR MORE DAYS BACK SHOULD GET COPIED FROM "/home" TO "/archive" DIRECTORY USING THE SCRIPT.&lt;BR /&gt;&lt;BR /&gt;The simple script that I could write is given below but it is not doing as to what I want&lt;BR /&gt;__________________________________________&lt;BR /&gt;DURATION=7&lt;BR /&gt;BACKUP=/tmp/ftp&lt;BR /&gt;HOME_DIR=/home/ftp&lt;BR /&gt;&lt;BR /&gt;cp -rf -p `find $HOME_DIR -mtime +$DURATION | sed 's/\.\///' | sed '/.*\/.*/d'` $BACKUP&lt;BR /&gt;__________________________________________&lt;BR /&gt;&lt;BR /&gt;It gets executed but gives me an error message at the end which is ---&lt;BR /&gt;&lt;BR /&gt;./copy_file.sh: line 5: /bin/cp: Argument list too long&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I also counted the no. of lines that it parses and it is 78916.&lt;BR /&gt;&lt;BR /&gt;Kindly help me in resolving this problem.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!!&lt;BR /&gt;&lt;BR /&gt;ATUL</description>
      <pubDate>Fri, 18 Aug 2006 04:42:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998126#M47613</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-18T04:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998127#M47614</link>
      <description>Hi Xperts,&lt;BR /&gt;&lt;BR /&gt;I'm attaching a .doc file depicting the directory structure for your convenience.&lt;BR /&gt;&lt;BR /&gt;Kindly help me.....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Atul</description>
      <pubDate>Fri, 18 Aug 2006 05:20:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998127#M47614</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-18T05:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998128#M47615</link>
      <description>As far as I can read someoneelse script this will give you the list of file not modified for last 7 days.&lt;BR /&gt;Well it seems to be OK, but how many files could be used as source for cp command? I mean how long can be the list of coping files? I think it have limited count...&lt;BR /&gt;&lt;BR /&gt;So try to use FOR cycle and coping one file from list after another.&lt;BR /&gt;&lt;BR /&gt;I hope you know and use this but: &lt;A href="http://www.tldp.org/LDP/abs/html/" target="_blank"&gt;http://www.tldp.org/LDP/abs/html/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;(nice "book" about scripting)</description>
      <pubDate>Fri, 18 Aug 2006 06:07:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998128#M47615</guid>
      <dc:creator>g33k</dc:creator>
      <dc:date>2006-08-18T06:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998129#M47616</link>
      <description>Hi...&lt;BR /&gt;&lt;BR /&gt;As I know it will be....&lt;BR /&gt;&lt;BR /&gt;List of file not modified in last 7 days but modified before that time.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Atul&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Aug 2006 06:26:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998129#M47616</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-18T06:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998130#M47617</link>
      <description>As I allready said the argument list is too long cp is not able too handle such many parametres as sources. so solution is:&lt;BR /&gt;&lt;BR /&gt;for File in `find $HOME_DIR -mtime +$DURATION | sed 's/\.\///' | sed '/.*\/.*/d'`; do cp $File $BACKUP; done</description>
      <pubDate>Fri, 18 Aug 2006 06:35:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998130#M47617</guid>
      <dc:creator>g33k</dc:creator>
      <dc:date>2006-08-18T06:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998131#M47618</link>
      <description>Thanks....&lt;BR /&gt;&lt;BR /&gt;As you suggested...I also did the same thing but removed the "sed" portion from it....&lt;BR /&gt;&lt;BR /&gt;Mine looks like dis.....&lt;BR /&gt;&lt;BR /&gt;DURATION=7&lt;BR /&gt;BACKUP=/tmp/ftp&lt;BR /&gt;HOME_DIR=/home/ftp&lt;BR /&gt;&lt;BR /&gt;for file in [ `find $HOME_DIR -mtime +$DURATION` ]&lt;BR /&gt;do&lt;BR /&gt;        cp -rf -p $file $BACKUP&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank u vereeeee much for your valuable help....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Atul</description>
      <pubDate>Fri, 18 Aug 2006 06:38:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998131#M47618</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-18T06:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998132#M47619</link>
      <description>you are wellcome it was quite easy, when I was on the begining of my scripting way I've done a lot of mistakes... it wants just time and practice...</description>
      <pubDate>Fri, 18 Aug 2006 06:43:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998132#M47619</guid>
      <dc:creator>g33k</dc:creator>
      <dc:date>2006-08-18T06:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998133#M47620</link>
      <description>you could also use two alternative methods&lt;BR /&gt;&lt;BR /&gt;find $HOME_DIR -mtime +$DURATION` -exec cp -rf -p {} $BACKUP \;&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;find $HOME_DIR -mtime +$DURATION` | xargs cp -rf -p $BACKUP&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 19 Aug 2006 14:13:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998133#M47620</guid>
      <dc:creator>Manuel Wolfshant</dc:creator>
      <dc:date>2006-08-19T14:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998134#M47621</link>
      <description>Hi Manuel,&lt;BR /&gt;&lt;BR /&gt;The command that you mentioned is not working as I want.&lt;BR /&gt;&lt;BR /&gt;What I want is that "the files or directories that are being searched for should get copied in the same way as they are present. &lt;BR /&gt;In other other words I should say that the directory hierarchy should be maintained at the destination as well.&lt;BR /&gt;&lt;BR /&gt;I appreciate your help. Your command did work, but it doesn't copy the files as per their hierarchy.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks!!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ATUL</description>
      <pubDate>Tue, 22 Aug 2006 04:21:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998134#M47621</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-22T04:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998135#M47622</link>
      <description>Hey Manuel,&lt;BR /&gt;&lt;BR /&gt;I've attached a file with the output of few of my file names that I want to copy from the home directory location and wanna paste them inside /archive directory in the same hierarchy as they are present.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Atul</description>
      <pubDate>Tue, 22 Aug 2006 04:41:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998135#M47622</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-08-22T04:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998136#M47623</link>
      <description>Found the solution&lt;BR /&gt;&lt;BR /&gt;Thanks to all....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ATUL</description>
      <pubDate>Wed, 20 Dec 2006 02:45:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-a-shell-script/m-p/4998136#M47623</guid>
      <dc:creator>Atul Gautam</dc:creator>
      <dc:date>2006-12-20T02:45:04Z</dc:date>
    </item>
  </channel>
</rss>

