why this can't be undone

Discuss and share scripts and script files...
Huidong
Posts: 213
Joined: 18 May 2011 21:55

why this can't be undone

Post 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.

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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.

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post 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.

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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? :?

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post by Huidong »

I'm aware of that, but I use it only when I know all the contents have different names.

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post 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.

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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;

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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.) 8)

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post 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!

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post 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.

RalphM
Posts: 2089
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: why this can't be undone

Post 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.
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: why this can't be undone

Post 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
Power-hungry user!!!

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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;
  }

admin
Site Admin
Posts: 66253
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: why this can't be undone

Post 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.

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: why this can't be undone

Post 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.

Post Reply