Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2391

Pathname: moving files & directories

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail
From Simon Harrison <simon@simonharrison.net>
Newsgroups comp.lang.ruby
Subject Pathname: moving files & directories
Date Wed, 6 Apr 2011 13:18:25 -0500
Organization Service de news de lacave.net
Lines 33
Message-ID <b2265767440a64a48853a41cea71fe1a@ruby-forum.com> (permalink)
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1302113933 21191 65.111.164.187 (6 Apr 2011 18:18:53 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Wed, 6 Apr 2011 18:18:53 +0000 (UTC)
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 381051
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <b2265767440a64a48853a41cea71fe1a@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:2391

Show key headers only | View raw


This came up at work a while ago and our IT dept. said it was
impossible. If we have the following paths:

dir/customer1/file1
dir/customer1/file2
dir/customer1/lots more files
dir/customer2/file1
dir/customer2/file2
dir/customer2/file3
dir/customer2/obsolete/file1
dir/customer2/oblolete/file2
dir/customer3/file1
dir/customer3/file2
dir/customer3/obsolete/file1

.etc

how can we end up with this:

/newdir/obsolete/customer2/file1
/newdir/obsolete/customer2/file2
/newdir/obsolete/customer3/file1

.etc

I can't really experiment at work because the IT folk would probably not
be best pleased if I delete everything. I'm not sure what to use. I can
get the paths easily with Dir.glob and then grep for 'obsolete'. But,
I've no idea how to rename the paths. Any help appreciated.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Pathname: moving files & directories Simon Harrison <simon@simonharrison.net> - 2011-04-06 13:18 -0500
  Re: Pathname: moving files & directories Robert Klemme <shortcutter@googlemail.com> - 2011-04-06 21:07 +0200
  Re: Pathname: moving files & directories Jeremy Bopp <jeremy@bopp.net> - 2011-04-06 14:26 -0500
  Re: Pathname: moving files & directories Simon Harrison <simon@simonharrison.net> - 2011-04-06 15:09 -0500

csiph-web