Page 1 of 1
copy to current folder with a different name
Posted: 03 Feb 2009 23:08
by j0nezn
I am try to use a script or a user defined command to copy a file to the same directory but with an appended extension. example I want to copy C:\temp\test.ini to c:\temp\test.ini.org. I tried this
Code: Select all
copyto "<curitem>.org", "<curitem>"
which copies the file to c:\temp\test.ini.org\test.ini. Where am I getting this wrong I have tried other examples but no luck.
Re: copy to current folder with a different name
Posted: 04 Feb 2009 00:11
by serendipity
j0nezn wrote:I am try to use a script or a user defined command to copy a file to the same directory but with an appended extension. example I want to copy C:\temp\test.ini to c:\temp\test.ini.org. I tried this
Code: Select all
copyto "<curitem>.org", "<curitem>"
which copies the file to c:\temp\test.ini.org\test.ini. Where am I getting this wrong I have tried other examples but no luck.
Hi and Welcome to XY,
copyto will not work because the first parameter (in your case <curitem>.org) is meant for path only and therefore it creates a folder with that name.
Try this, a bit longish though:
Code: Select all
//Duplicate file with custom extension
focus;
$item=<curname>;
#201;
#202;
setting HideFoldersInList;
sortby c, d;
sel 1;
rename b, "$item.org/e";
Maybe there is a shorter script, but right now I am in a hurry.
Re: copy to current folder with a different name
Posted: 04 Feb 2009 02:35
by TheQwerty
You could do this with New()..
Code: Select all
::New("<curname>.org", "file", "<curitem>");
Will create a copy of the currently selected and focused file with ".org" appended to the name.
Re: copy to current folder with a different name
Posted: 04 Feb 2009 04:58
by serendipity
TheQwerty wrote:You could do this with New()..
Code: Select all
::New("<curname>.org", "file", "<curitem>");
Will create a copy of the currently selected and focused file with ".org" appended to the name.
Thanks!! I was actually looking for this low level copier before posting my longish script.
Re: copy to current folder with a different name
Posted: 04 Feb 2009 17:03
by j0nezn
TheQwerty wrote:You could do this with New()..
Code: Select all
::New("<curname>.org", "file", "<curitem>");
Will create a copy of the currently selected and focused file with ".org" appended to the name.
Thanx worked like a charm would have never thought of using new.
Re: copy to current folder with a different name
Posted: 04 Feb 2009 17:39
by admin
j0nezn wrote:TheQwerty wrote:You could do this with New()..
Code: Select all
::New("<curname>.org", "file", "<curitem>");
Will create a copy of the currently selected and focused file with ".org" appended to the name.
Thanx worked like a charm would have never thought of using new.
Yes, it's surely unusual to use new for a copy. But it starts making sense when you think of the "[Shell] New" items offered in Explorer, which in fact are nothing but copies as well. And it's the same with XYplorer's "New Items" menu, where you can create "prefilled" new items.