Copy Remote http:// File Path

I often upload files to my ftp and give the link to someone. usually i have to use my browser and navigate to the folder where i put it in and add the filename to the url. to make this process faster i made a hotkey&button with this command:

Clipboard COPYNAMES=url REGEXP (ftp://|file:///)(.*)//(.*) http://\2/\3 

it copies the paths of the selected files to clipboard and turns it into http urls. this command only works if the ftp and the http domains are the same.

the button code for a 3-way button also with Copy Local Path and Print Folder (i left the last one out because it was a stock command and in German):

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none" type="three_button">
	<label>Copy paths</label>
	<icon1>#clipcopy</icon1>
	<icon2>#printfolder</icon2>
	<button backcol="none" display="both" textcol="none">
		<label>Copy filepaths</label>
		<tip>Copy filepaths</tip>
		<icon1>#newcommand</icon1>
		<function type="normal">
			<instruction>CLIPBOARD COPYNAMES</instruction>
		</function>
	</button>
	<button backcol="none" display="both" textcol="none">
		<label>Copy remote filepaths</label>
		<tip>Copy remote filepaths</tip>
		<icon1>#newcommand</icon1>
		<function type="normal">
			<instruction>Clipboard COPYNAMES=url REGEXP (ftp://|file:///)(.*)//(.*) http://\2/\3</instruction>
		</function>
	</button>
</button>
1 Like

Nice one.

I do the same thing with images.

Unfortunately, my ISP uses different names for ftp and web servers, but with luck I may be able to tweak your version.

PS Easy to do, although not elegant, simply substitute the relevant bit of the URL for the ftp address.

yeah, unfortunately there is no more elegant way.

There is an elegant way to solve the ftp and http domains being different, mentioned in that thread:

[quote="leo"]You can give the command you are using as many pairs of regex find & replace strings as you want.

So you could give the command a bunch of expressions which find one host/prefix and replace it with another, for example.[/quote]

e.g.

Clipboard COPYNAMES=url REGEXP (ftp|file)://ftp\.mysite\.org//(.*) http://www.mysite.org/\2

and you can give more than one find & replace pair:

Clipboard COPYNAMES=url REGEXP file://site_a//(.*) http://host_a/\1 file://site_b//(.*) http://host_b/\1

Very handy - works like a charm. Thank you for posting.

[quote="leo"]e.g.

Clipboard COPYNAMES=url REGEXP (ftp|file)://ftp\.mysite\.org//(.*) http://www.mysite.org/\2

and you can give more than one find & replace pair:

Clipboard COPYNAMES=url REGEXP file://site_a//(.*) http://host_a/\1 file://site_b//(.*) http://host_b/\1[/quote]

I'm being thick and don't really understand all this. :cry:

This button would be very handy for me..

Clipboard COPYNAMES=url REGEXP (ftp://|file:///)(.*)//(.*) http://\2/\3

returns = http://ftp.djow.co.uk/djow/bitsbobs/test.JPG

I'd like help altering it so it returns = http://www.djow.co.uk/bitsbobs/test.JPG

Can someone please help be alter this command line.. (i'm really clueless on them!)

Thanks :thumbsup:

^^ Sorry thought this thread was in the help section.. opps move if needed please

[quote="Watoh"]Clipboard COPYNAMES=url REGEXP (ftp://|file:///)(.)//(.) http://\2/\3
returns = http://ftp.djow.co.uk/djow/bitsbobs/test.JPG

I'd like help altering it so it returns = http://www.djow.co.uk/bitsbobs/test.JPG[/quote]

Try this:

Clipboard COPYNAMES=url REGEXP (ftp://|file:///)ftp\.(.*)//(.*) http://www.\2/\3

Thanks Leo..

that returns = http://www.djow.co.uk/djow/bitsbobs/test.JPG

I need it on omit the extra djow so it returns = http://www.djow.co.uk/bitsbobs/test.JPG

Thanks, i really appreciate the help.

Clipboard COPYNAMES=url REGEXP (ftp://|file:///)ftp\.djow\.co\.uk//djow/(.*) http://www.djow.co.uk/\2

I think. :slight_smile: Something like that.

Perfect leo..that works perfectly, that is such a damn useful button for me :smiley:

Hi Could I be cheeky?

To save opening another thread, could someone help with ftp>http for:

ftp://ftp.{subdomain.domain.yada}//htdocs/generic-folder/filename.filetype

With htdocs removed from the string.

Many thanks.