Page 1 of 2
why this can't be undone
Posted: 21 May 2011 19:56
by Huidong
Before I tried the following command
Code: Select all
::moveto "<curpath>", "<curitem>\*"
in order to move contents of the last selected folder out. It worked, but I noticed that this can not be undone! Why's that?
Thank you.
Re: why this can't be undone
Posted: 21 May 2011 20:16
by admin
Huidong wrote:Before I tried the following command
Code: Select all
::moveto "<curpath>", "<curitem>\*"
in order to move contents of the last selected folder out. It worked, but I noticed that this can not be undone! Why's that?
Thank you.
This is because of the wildcard. The wildcard is passed directly to the shell in this case; therefore the actually moved files are unknown to XY. So XY cannot undo the move.
BTW, I don't really understand what you want. Can you define your task once more, please.
Re: why this can't be undone
Posted: 21 May 2011 20:27
by Huidong
Thank you, I see why to some extent.
What I want is to move all stuff inside a selected folder (hence <curitem>\*) out of the folder (move up one level), i.e. suck things out of a folder, that's it. To me that's the weakest version of a program called "Suction"
http://mike.geek-republic.com/software/suction/
which does the suction recursively no matter how deep the dir structure is.
Re: why this can't be undone
Posted: 21 May 2011 20:30
by admin
Huidong wrote:Thank you, I see why to some extent.
What I want is to move all stuff inside a selected folder (hence <curitem>\*) out of the folder (move up one level), i.e. suck things out of a folder, that's it. To me that's the weakest version of a program called "Suction"
http://mike.geek-republic.com/software/suction/
which does the suction recursively no matter how deep the dir structure is.
Merge them all into one folder, hence risking multiple overwrites?

Re: why this can't be undone
Posted: 21 May 2011 20:40
by Huidong
I'm aware of that, but I use it only when I know all the contents have different names.
Re: why this can't be undone
Posted: 21 May 2011 20:42
by Huidong
Without recursion this is a trivial command since I can go into the folder, selection all, and cut and paste manually. It becomes worthy if it can do recursion down to the deepest level.
Re: why this can't be undone
Posted: 21 May 2011 21:52
by admin
OK, got it. In the
next beta version you can do this:
Code: Select all
// suction: move all files (recursively) from the folder selected in
// the file list (<curitem>) up to the current folder
$filelist = folderreport("files", "r", <curitem>, "r", , "|");
moveto <curpath>, $filelist;
Re: why this can't be undone
Posted: 21 May 2011 22:00
by admin
admin wrote:OK, got it. In the
next beta version you can do this:
Code: Select all
// suction: move all files (recursively) from the folder selected in
// the file list (<curitem>) up to the current folder
$filelist = folderreport("files", "r", <curitem>, "r", , "|");
moveto <curpath>, $filelist;
OK, you can try this now with
v9.90.0936. (It even can be undone.)

Re: why this can't be undone
Posted: 21 May 2011 22:07
by Huidong
This is truly awesome, I'll go and have a try. So "files" is a new type, and you added separator as the sixth argument, is that right?
Thanks!
Re: why this can't be undone
Posted: 21 May 2011 22:27
by Huidong
Tried, it worked perfectly for single folder, but I wonder if it's possible to do it for multiple selected folders? I tried <selitems> instead of <curitem> but didn't work.
Re: why this can't be undone
Posted: 21 May 2011 22:38
by RalphM
@Huidong
You're aware there's an edit feature for posts on this forum, aren't you?
It makes reading a topic somehow tiresome if there's quite a number of posts from just one person without anybody else chiming in.
So I'd kindly ask you to edit the previous post if no one else posted a reply in between, thanks.
Re: why this can't be undone
Posted: 21 May 2011 23:33
by tiago
Don:
Any way to force this to report subfolders contents apart?
$filelist = text folderreport("files", "r", , "r", , "|");
So instead of
Code: Select all
C:\FirefoxPortable\App\DefaultData\profile\bookmarks.html
C:\FirefoxPortable\App\DefaultData\profile\chrome\userChrome-example.css
C:\FirefoxPortable\App\DefaultData\profile\chrome\userContent-example.css
C:\FirefoxPortable\App\DefaultData\profile\localstore.rdf
C:\FirefoxPortable\App\DefaultData\profile\mimeTypes.rdf
C:\FirefoxPortable\App\DefaultData\profile\prefs.js
I'd have
Code: Select all
C:\FirefoxPortable\App\DefaultData\profile\bookmarks.html
C:\FirefoxPortable\App\DefaultData\profile\localstore.rdf
C:\FirefoxPortable\App\DefaultData\profile\mimeTypes.rdf
C:\FirefoxPortable\App\DefaultData\profile\prefs.js
C:\FirefoxPortable\App\DefaultData\profile\chrome\userChrome-example.css
C:\FirefoxPortable\App\DefaultData\profile\chrome\userContent-example.css
Re: why this can't be undone
Posted: 22 May 2011 08:02
by admin
Huidong wrote:Tried, it worked perfectly for single folder, but I wonder if it's possible to do it for multiple selected folders? I tried <selitems> instead of <curitem> but didn't work.
Easy (needs v9.90.0936 or later):
Code: Select all
// suction: move all files (recursively) from all folders selected in
// the file list up to the current folder
foreach($token, <get selecteditemspathnames |>) {
$filelist = folderreport("files", "r", $token, "r", , "|");
moveto <curpath>, $filelist;
}
Re: why this can't be undone
Posted: 22 May 2011 08:03
by admin
tiago wrote:Don:
Any way to force this to report subfolders contents apart?
$filelist = text folderreport("files", "r", , "r", , "|");
So instead of
Code: Select all
C:\FirefoxPortable\App\DefaultData\profile\bookmarks.html
C:\FirefoxPortable\App\DefaultData\profile\chrome\userChrome-example.css
C:\FirefoxPortable\App\DefaultData\profile\chrome\userContent-example.css
C:\FirefoxPortable\App\DefaultData\profile\localstore.rdf
C:\FirefoxPortable\App\DefaultData\profile\mimeTypes.rdf
C:\FirefoxPortable\App\DefaultData\profile\prefs.js
I'd have
Code: Select all
C:\FirefoxPortable\App\DefaultData\profile\bookmarks.html
C:\FirefoxPortable\App\DefaultData\profile\localstore.rdf
C:\FirefoxPortable\App\DefaultData\profile\mimeTypes.rdf
C:\FirefoxPortable\App\DefaultData\profile\prefs.js
C:\FirefoxPortable\App\DefaultData\profile\chrome\userChrome-example.css
C:\FirefoxPortable\App\DefaultData\profile\chrome\userContent-example.css
Nope.
Re: why this can't be undone
Posted: 22 May 2011 09:31
by Huidong
admin wrote:Huidong wrote:Tried, it worked perfectly for single folder, but I wonder if it's possible to do it for multiple selected folders? I tried <selitems> instead of <curitem> but didn't work.
Easy:
Code: Select all
// suction: move all files (recursively) from all folders selected in
// the file list up to the current folder
foreach($token, <get selecteditemspathnames |>) {
$filelist = folderreport("files", "r", $token, "r", , "|");
moveto <curpath>, $filelist;
}
Perfect! Learning new stuff, powerful stuff; easy for masters, but I never even heard of foreach!
Thank you very much.