Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] moving files to existing structure

Expand Messages
  • Paul Archer
    ... Thanks for the code. I ended up doing it in Perl, but it s always nice to see how different people handle the same task. ... You are quite right. I should
    Message 1 of 15 , Aug 4, 2004
      > >>> tigger@... 03/08/2004 3:27:27 pm >>>
      > >As I mentioned in another post, my problem is that due to the sheer volume
      > >of the data 3/4 of a terabyte or so, I simply can't do anything that copies
      > >then removes. I just don't have the room.
      > >Good suggestions otherwise, though.
      >
      > Then the move suggestion should work for you. They didn't all involve copying.
      >
      > cd /somedir/traces
      > for i in `find . -print | sort`
      > do
      > ([ -d $i ] && [ -x /data/traces/$i ]) || mkdir /data/traces/$i
      > [ -f /data/traces/$i ] && mv /data/traces/$i /data/traces/${i}.archived
      > [ -f $i ] && mv $i /data/traces/$i
      > done
      >
      > Kind of verbose at 7 lines, but it'll get the job done, and won't require
      > any more space. Explicit for those who want explicitness, I guess. The
      > second line that begins with "test" should take care of file name
      > conflicts, but won't do anything about directories. I tried it here on
      > one of my rigs, and it seems to work.
      >
      Thanks for the code. I ended up doing it in Perl, but it's always nice to
      see how different people handle the same task.



      > And for the record: you never mentioned the space requirements being a
      > restriction. You just mentioned that there were a lot of files, which
      > doesn't mean much.
      >

      You are quite right. I should have mentioned it. The whole reason for my
      original post, after all, was that I had millions of files to move, and was
      afraid that it would take forever (and I was pretty nervous about messing
      something up, as that could mean having to pull this data off of tape
      *again*, a process that took 4 days the first time).

      Paul Archer
    • merlyn@stonehenge.com
      ... Paul FWIW, I did word my original post poorly, and left out some important Paul details--like the fact that I was looking for hints, And I gave you those
      Message 2 of 15 , Aug 4, 2004
        >>>>> "Paul" == Paul Archer <tigger@...> writes:

        Paul> FWIW, I did word my original post poorly, and left out some important
        Paul> details--like the fact that I was looking for hints,

        And I gave you those hints. My first response was a series
        of perldoc commands that would have led you to most of the solution
        I posted.

        Paul> not 8 lines of
        Paul> carefully crafted code by the Master;

        And while your solution might not have been 8 lines, that was part of
        my first response to show you that the task is NOT HARD.

        Paul> or that I had to run this rename on
        Paul> over 3.6 million files comprising almost a terabyte of data and 4 days of
        Paul> tape restores, and I was really nervous about doing something wrong, as well
        Paul> as worried about efficiency.

        And if you weren't confident to do that yourself, you should have
        HIRED SOMEONE. Not asked for FREE LABOR on a technical discussion
        list.

        Paul> Perhaps had I mentioned those facts, you would have been less harsh. But
        Paul> it's a bit late now for both of us.

        I'm only harsh when I see people misunderstanding the purpose of a
        technical mailing list, or wanting to be SO LAZY to get others to do
        their work for them.

        I have absolutely no problem with people showing effort, then getting
        stuck, then asking for the next step here. I help people like that
        here (and all over) all the time. Maybe you should try to understand
        why you didn't come across like that, but rather like someone who
        wanted the world for free, instead of working toward your goal.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • Jeff Eggen
        ... Yeah, TMTOWTDI and all that. I usually don t use Perl for file moves & copies, unless they are part of a larger whole. Besides, a lot of times seeing a
        Message 3 of 15 , Aug 9, 2004
          >>> tigger@... 04/08/2004 8:21:36 am >>>
          >Thanks for the code. I ended up doing it in Perl, but it's always nice to
          >see how different people handle the same task.

          Yeah, TMTOWTDI and all that. I usually don't use Perl for file moves & copies, unless they are part of a larger whole. Besides, a lot of times seeing a solution in the shell will help me visualise a solution in Perl, and vice-versa.

          Have fun!

          Jeff Eggen
          IT Programmer Analyst
          Saskatchewan Government Insurance
          Ph (306) 751-1795
          email jeggen@...

          ************DISCLAIMER*************
          This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee, please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that using, disclosing, copying or distributing the contents of this information is strictly prohibited.
          ************DISCLAIMER*************
        Your message has been successfully submitted and would be delivered to recipients shortly.