1HXCOPY(1) HTML-XML-utils HXCOPY(1)
2
3
4
6 hxcopy - copy an HTML file and update its relative links
7
9 hxcopy [ -i old-URL ] [ -o new-URL ] [ file-or-URL [ file-or-URL ] ]
10
12 The hxcopy command copies its first argument to its second argument,
13 while updating relative links. The input is assumed to be HTML or XHTML
14 and may be slightly reformatted in the process.
15
16 If the second argument is omitted, hxcopy writes to standard output. In
17 this case the option -o is required. If the first argument is also
18 omitted, hxcopy reads from standard input. In this case the option -i
19 is required.
20
22 The following options are supported:
23
24 -i old-URL
25 For the purposes of updating relative links, act as if old-
26 URL is the location from which the input is copied. If this
27 option is omitted, the actual location of the first argument
28 is used for calculating relative links.
29
30 -o new-URL
31 For the purposed of updating relative links, act as if new-
32 URL is the location to which the input is copied. If this
33 option is omitted, the actual location of the second argument
34 is used for calculating relative links.
35
37 Assume the HTML file foo.html contains a relative link to
38 "../bar.html". Here are some examples of commands:
39
40 hxcopy foo.html bar/foo.html
41 The file foo.html is copied to ../bar/foo.html and the relative
42 link to "../bar.html" becomes "../../bar.html".
43
44 hxcopy foo.html ../foo.html
45 The file foo.html is copied to ../foo.html and the relative link
46 to "../bar.html" is rewritten as "bar.html".
47
48 hxcopy -i http://my.org/dir1/foo.html -o http://my.org/foo.html
49 file1.html file2.html
50 The file file1.html is copied to file2.html and the relative
51 link to "../bar.html" is rewritten as "bar.html". A command like
52 this may be useful to update files that are later uploaded to a
53 server.
54
56 Unlike the last argument of cp(1), the last argument of hxcopy must be
57 a file, not a directory.
58
59 The second argument must be a local file. Writing to a URL is not yet
60 implemented. To work around this, replace hxcopy file.html http://exam‐
61 ple.org/file.html by hxcopy -o http://example.org/file.html file.html
62 tmp.html and then upload tmp.html to the given URL with some other com‐
63 mand, such as curl(1). The first argument, however, may be a URL.
64 hxcopy will download the given file. (Currently only HTTP is sup‐
65 ported.)
66
68 cp(1), curl(1), hxwls(1)
69
70
71
725.x 9 Dec 2008 HXCOPY(1)