Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10795
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <t@jollybox.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'python,': 0.01; 'python)': 0.05; 'way:': 0.05; 'rule.': 0.09; 'solaris,': 0.09; 'subject:files': 0.09; 'exception': 0.12; 'am,': 0.13; 'wrote:': 0.15; '11:32,': 0.16; 'mkdir': 0.16; 'received:192.168.1.40': 0.16; 'suggested.': 0.16; 'symbolic': 0.16; 'aug': 0.19; 'command': 0.19; 'header:In-Reply-To:1': 0.22; 'trying': 0.23; 'structure': 0.23; 'tue,': 0.23; 'shell': 0.29; 'blocks': 0.30; 'implementing': 0.32; 'pure': 0.32; 'implement': 0.33; 'actually': 0.33; "i've": 0.33; 'to:addr:python-list': 0.34; 'header:User- Agent:1': 0.34; 'there': 0.34; 'however,': 0.34; 'quite': 0.34; 'installed': 0.35; 'pretty': 0.35; 'probably': 0.35; 'assuming': 0.37; 'but': 0.37; 'could': 0.37; 'using': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'linked': 0.38; 'think': 0.38; 'easier': 0.39; 'program,': 0.39; 'received:192.168.1': 0.39; 'should': 0.39; 'either': 0.39; 'to:addr:python.org': 0.39; 'kind': 0.60; 'peter': 0.62; 'link': 0.63; 'links,': 0.64; 'received:62': 0.67; 'safe': 0.69; 'everything.': 0.84; 'from:addr:t': 0.84; 'presumably': 0.93 |
| Date | Wed, 03 Aug 2011 11:47:31 +0200 |
| From | Thomas Jollans <t@jollybox.de> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110628 Thunderbird/5.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Hardlink sub-directories and files |
| References | <3d2c3d3b-085e-4f3b-903d-726a31e607f4@b34g2000yqi.googlegroups.com> <4E37CDCF.7060501@jollybox.de> <CAGGBd_qm3_wamKNv2LW5giYKmMpyHFoo=Y-8kXZZLmxPPk3G3A@mail.gmail.com> |
| In-Reply-To | <CAGGBd_qm3_wamKNv2LW5giYKmMpyHFoo=Y-8kXZZLmxPPk3G3A@mail.gmail.com> |
| X-Enigmail-Version | 1.2 |
| OpenPGP | id=5C8691ED |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1828.1312364840.1164.python-list@python.org> (permalink) |
| Lines | 62 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312364840 news.xs4all.nl 23838 [2001:888:2000:d::a6]:49648 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10795 |
Show key headers only | View raw
On 03/08/11 03:59, Dan Stromberg wrote: > > On Tue, Aug 2, 2011 at 3:13 AM, Thomas Jollans <t@jollybox.de > <mailto:t@jollybox.de>> wrote: > > On 02/08/11 11:32, loial wrote: > > I am trying to hardlink all files in a directory structure using > > os.link. > > > > However I do not think it is possible to hard link directories ? > > > That is pretty true. I've heard of hardlinked directories on Solaris, > but that's kind of an exception to the general rule. > > > > So presumably I would need to do a mkdir for each sub-directory > > encountered? > > Or is there an easier way to hardlink everything in a directory > > structure?. > > > > The requirement is for hard links, not symbolic links > > > > Yes, you have to mkdir everything. However, there is an easier way: > > subprocess.Popen(['cp','-Rl','target','link']) > > This is assuming that you're only supporting Unices with a working cp > program, but as you're using hard links, that's quite a safe bet, I > should think. > > > A little more portable way: > > $ cd from; find . -print | cpio -pdlv ../to > cpio: ./b linked to ../to/./b > ../to/./b > cpio: ./a linked to ../to/./a > ../to/./a > cpio: ./c linked to ../to/./c > ../to/./c > ../to/./d > cpio: ./d/1 linked to ../to/./d/1 > ../to/./d/1 > cpio: ./d/2 linked to ../to/./d/2 > ../to/./d/2 > cpio: ./d/3 linked to ../to/./d/3 > ../to/./d/3 > 0 blocks > > However, you could do it without a shell command (IOW in pure python) > using os.path.walk(). Is it more portable? I don't actually have cpio installed on this system. Which implementations of cp don't implement -R and -l? Of course, the best way is probably implementing this in Python, either with os.path.walk, or with a monkey-patched shutil.copytree, as Peter suggested. Thomas
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Hardlink sub-directories and files loial <jldunn2000@gmail.com> - 2011-08-02 02:32 -0700
Re: Hardlink sub-directories and files Peter Otten <__peter__@web.de> - 2011-08-02 12:01 +0200
Re: Hardlink sub-directories and files Thomas Jollans <t@jollybox.de> - 2011-08-02 12:13 +0200
Re: Hardlink sub-directories and files Tim Chase <python.list@tim.thechases.com> - 2011-08-02 06:17 -0500
Re: Hardlink sub-directories and files Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-08-02 21:46 -0700
Re: Hardlink sub-directories and files Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2011-08-03 12:02 +0530
Re: Hardlink sub-directories and files Grant Edwards <invalid@invalid.invalid> - 2011-08-03 14:22 +0000
Re: Hardlink sub-directories and files Thomas Jollans <t@jollybox.de> - 2011-08-03 17:08 +0200
Re: Hardlink sub-directories and files Ned Deily <nad@acm.org> - 2011-08-03 12:57 -0700
Re: Hardlink sub-directories and files Nobody <nobody@nowhere.com> - 2011-08-03 08:04 +0100
Re: Hardlink sub-directories and files Thomas Jollans <t@jollybox.de> - 2011-08-03 11:47 +0200
Re: Hardlink sub-directories and files Thomas Jollans <t@jollybox.de> - 2011-08-03 20:49 +0200
Re: Hardlink sub-directories and files Thomas Jollans <t@jollybox.de> - 2011-08-03 23:54 +0200
Re: Hardlink sub-directories and files Alexander Gattin <xrgtn@yandex.ru> - 2011-08-08 10:07 +0300
csiph-web