Need Command to Move/Delete Folders

I am trying to create a button that will move the contents of subfolders "down". I know how to create the button, itself - I just need help with the script in the button. I want to be able to select a folder and then click the button. The button needs to start at the selected folder and perform the script on the folders underneath that selected folder. There are always 7 subfolders. I want to delete the content of the last subfolder (S6) then MOVE the files in the previous subfolder (S5) to S6. Then MOVE the files in S4 to S5, etc. This "Ripple Down" button is deleting the oldest data set (in S6) and moving all the other data sets down, leaving an empty folder, SO, in which to put the newest file set. The folder names are always the same under any main (selected) folder so they can be hard coded in the script. It is just the selected folder that can vary.

Why don't you delete parent\S6, then sequentially rename parent\S5 as parent\S6, parent\S4 as parent\S5 and so on and create after renaming S0 as S1, create an S0? You don't need a script for that and could easily do it with a button.

I do not know how to do that. I Do not know the command syntax to figure out the path to the top folder (selected folder) and use it in a command to delete or rename a folder. Maybe my use of the word "script" is confusing. I am using it to mean more than one command in a button.

Simple way to do it:

Delete FILE="S6"
Rename FROM="S5" TO="S6"
Rename FROM="S4" TO="S5"
Rename FROM="S3" TO="S4"
Rename FROM="S2" TO="S3"
Rename FROM="S1" TO="S2"
Rename FROM="S0" TO="S1"
CreateFolder NAME="S0" READAUTO=no

(I've done it in quite a verbose way so it's safe if you change it to use folder names that look like arguments to any of the commands. It could be simplified for this exact example.)

2 Likes

Thank you for the sample code. I have copied it to a button and want to test it before running it on live data (no offense) :grinning: Is there a way for Dopus to copy the folder structure from one folder to another. In other words: I create a folder called TEST and want to copy all the subfolders from another folder into the TEST folder. But JUST the folder names - not any of the files in those folders.

That's sensible!

See here: Recreate Empty Directory Structure

1 Like

I tested the code you sent me and it works correctly (but you probably knew that). I did have to add the NORECYCLE and QUIET options to the command that deletes the folder. I did notice an omission (?) in the manual for the DELETE command (on page 638 of my copy of the DOPUS 12 manual). It is talking about the FILE parameter. It says, "Specifies the name of the file or files to delete.". It does NOT say anything about FOLDER name. But clearly it does work with folders.

"File" generally means "file or folder". The manual would become very tedious to read (and write!) if it was spelled out explicitly every time.

That is fair. However, maybe putting that somewhere near the top of the manual, one time, in a big, bold font would address that issue without making the manual repetitive.

Nobody would read it. :smiley:

1 Like

That is a good possibility, but like all the "Terms and Conditions" and other documents we must confirm we read before being able to download software or create an account on a website, it is more of a CYA for the provider. So you can always say, it was in the manual. Just put that info and other similar, important, general info in a section at the top of the manual. Then the onus is on the reader and you have done your best to provide that info. It is easy for you to do and, for people who do read (or at least skim) the manual, the info IS there.

Do we really discuss "file means file & folder" here? Use search how often this was not clear in the past and you will see, a hint in manual is not necessary!

Do we need to update all buttons text also then? They often use "file(s)" only ("Dateien" in German) :wink:

If this misunderstanding occurred frequently, that should be a hint that some kind of statement in the documentation could be helpful. As far as search, what search term would I use? Unfortunately the words File and Folder are extremely common and would produce voluminous results. Besides, I thought it was an omission in the manual so I would not have even thought to do a search or know what to search for.

I thought it was clear that your misunderstanding does NOT occure frequently! :thinking:

BTW these apps are all so-called file-manager! Nobody asks for a folder-manager, because "file" is a common used expression for file and folder operations/apps.

As said the buttons in DO only say "file", while some work for both, files and folders, and some for files only. And now?

But enough discussed, I agree to Leo.

If some buttons work only for files and some work for both files and folders, I would think it important to document the difference.

Yes, I DID misread your earlier comment and thought it said this was a frequent issue. Mea Culpa

Right, enough discussion.