#1 2022-01-22 01:52

nkormanik
Member
From: Salt Lake City
Registered: 2015-02-26
Posts: 24

Moving items....

Several years ago I had asked about this, MOVING items, and the response was that ReNamer does not focus on moving.

HOWEVER, it was pointed out that, indeed, ReNamer was capable of moving items.  By using slashes.

I don't remember exactly how.

But..., I'd like to again request the ability to move items, once renamed.

Case at hand:

On desktop.  Rename a set of items.  Windows rearranges icons making the renamed items hard to find.

Preferably, after renaming the items, ReNamer could put said items into a folder of user's choosing.  This could be the final line of the code user runs.

Thanks!!

Nicholas Kormanik

Offline

#2 2022-01-24 08:28

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Moving items....

nkormanik wrote:

I'd like to again request the ability to move items, once renamed.

You can simply insert the new path (absolute or relative) as a prefix to the new name, that's it.

See this article for additional information and examples: ReNamer:Renaming_to_another_folder.

Offline

#3 2022-01-24 10:18

nkormanik
Member
From: Salt Lake City
Registered: 2015-02-26
Posts: 24

Re: Moving items....

How about THAT!

ReNamer just gets better and better.....

Offline

#4 2022-08-19 17:37

Togolen8
Member
Registered: 2022-08-19
Posts: 9

Re: Moving items....

Hello, almost the same subject I didn't want to create a new thread.

I renamed my files to 001, 002, 999.
I need them to move to new folders by block of a specific number, let's say 10.
I want the new folder to be renamed with the name of the first file inside, 001, 011, etc

Thank you.

Offline

#5 2022-08-19 20:10

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Moving items....

Hi Togolen8, welcome.

You know ReNamer is a tool to rename files and folders, not to manage your file hierarchy.
But ReNamer can do his work with the help of PascalScript,.... and with that you can do many things,
... we will see if we find a solution for you. But may need some time.


And, this issue will probably moved to an own thread, to keep things belonging together into separat places.



 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#6 2022-08-19 20:42

Togolen8
Member
Registered: 2022-08-19
Posts: 9

Re: Moving items....

Stefan wrote:

Hi Togolen8, welcome.

You know ReNamer is a tool to rename files and folders, not to manage your file hierarchy.
But ReNamer can do his work with the help of PascalScript,.... and with that you can do many things,
... we will see if we find a solution for you. But may need some time.


And, this issue will probably moved to an own thread, to keep things belonging together into separat places.



 

I understand. I finally bought ReNamer after using it for years with very basic needs. I was curious, looking for something called a .bat file for my need and I found this post. Now I have to deal with 10s of 1000s of files and I use ReNamer a lot.

Thanks. I've bookmarked this post. I have another question, will create a new thread.

Offline

#7 2022-08-24 13:02

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Moving items....

Togolen8 wrote:

Hello, almost the same subject I didn't want to create a new thread.

I renamed my files to 001, 002, 999.
I need them to move to new folders by block of a specific number, let's say 10.
I want the new folder to be renamed with the name of the first file inside, 001, 011, etc

Thank you.


You may want to try this.

- create a backup of your files
- add twenty-two of your files to ReNamer as files
- add this PascalScript rule
( read more there > https://www.den4b.com/wiki/ReNamer:Rules:PascalScript )

If that works, try with the rest of your files.


Edit: block modified:
--------------------------------------------------------------------------
But, @den4b , I am lost again on terminating the whole script on error, I forgot how to do this:
 
Description of flow control statements:
Break; - Ends the current loop.
Continue; - Skips the current iteration of a loop.
Exit; - Terminates the current routine (function or procedure or, used in the main block of code, the whole script).
Please note: Exit works only on the current iteration (file) of the script, but the script will be executed for the next file again however.

Update after response of den4b:
For to stop the whole process and display an error message to the user, utilize "error()"
Error( ' your error message ' );

if (not WideDirectoryExists(TargetFolder)) then EXIT;
if (not WideDirectoryExists(TargetFolder)) then Error( ' your error message , script will end here ' );
Please help tongue
I have comment out that part in the script below, so the user just have to be sure that the "TargetFolder" already exists.
--------------------------------------------------------------------------





{*
2022-08-24 by Stefan
Purpose:      COPY AMOUNT of files to a new created folder, named like the first file of every loop.
Additional:   After every loop of "AMOUNT" of files, the next filename is used as the new folder name.

UserSettings: 
Set the "TargetPath"-var to a wanted path. This whole path MUST EXIST beforehand! Use NO trailing backslash here!
Set the "AMOUNT"-var to an integer which shows how many files you want to copy at one loop, like here "10".
*}

var
 ModResult,ModRemainder:Word;
 BasenameUsedAsFoldername:WideString;

const
 TargetPath = 'C:\Temp\test';
 AMOUNT = 10;

begin
{*
if (not WideDirectoryExists(TargetPath)) then
begin
  ShowMessage('Missing TargetPath which must already exist beforehand');
  exit;
end;
*}

  if (BasenameUsedAsFoldername ='') then BasenameUsedAsFoldername := WideExtractBaseName(FileName);
  WideCreateDir(TargetPath+'\'+BasenameUsedAsFoldername);

  //ShowMessage('COPY '+FileName+' to folder '+BasenameUsedAsFoldername);
  //WideCopyFile(const FromFile, ToFile: WideString; FailIfExists: Boolean)
  WideCopyFile(FilePath, TargetPath+'\'+BasenameUsedAsFoldername+'\'+FileName, True);

  //Reset the BasenameUsedAsFoldername-var after every AMOUNT-loop using Modulo:
  //DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);
  DivMod(GetCurrentFileIndex,AMOUNT,ModResult,ModRemainder);
  //ShowMessage('ModResult: '+IntToStr(ModResult)+' ModRemainder: '+IntToStr(ModRemainder))

  If ModRemainder = 0 then
  begin
    //ShowMessage('AMOUNT-loop done, will reset BasenameUsedAsFoldername to none, so the next file will give his name to set the new BasenameUsedAsFoldername');
    BasenameUsedAsFoldername :='';
  end;

  if (GetCurrentFileIndex = GetTotalNumberOfFiles) then
      ShowMessage('I am finished, should be all done?');
end.



HTH? big_smile


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#8 2022-08-24 14:52

Togolen8
Member
Registered: 2022-08-19
Posts: 9

Re: Moving items....

SPSLc8r.jpg

THANK YOU! Sorting 100s of 1000s of audio samples will be a blessing, not hell. Lots of positive energy towards you and the team!

By the way... Do you have a script for dark mode? big_smilelol Kidding.

Offline

#9 2022-08-26 09:38

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Moving items....

Stefan wrote:

I am lost again on terminating the whole script on error, I forgot how to do this:
Break - Ends the current loop.
Continue - Skips the current iteration of a loop.
Exit - Terminates the current routine (function or procedure).
if (not WideDirectoryExists(TargetFolder)) then EXIT;
Please help tongue

That is a correct description of flow control statements. You just need to remember that the main block of code is just another procedure/function, so you can use the "Exit" statement to terminate it.

Offline

#10 2022-08-26 11:35

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Moving items....

Thanks for the answer.

It is an logical error by me.
Of course exit works, but only for the current iteration/file.
And of course the script runs again for the next file. That has baffled me roll

So I was in real looking for to break the script execution for all the rest of the files.
IF (a=1) THEN stop the whole script execution completely, do not continue on the rest of the files.

I could use a "do it only once"-routine, to show my error message only once,
but the script would still run for every file and just do nothing.
But is there a better way? Like an "emergency exit"


Again, this is the use case:

begin
    if (not WideDirectoryExists(TargetPath)) then
    begin
      ShowMessage('Missing the TargetPath, which must already exist beforehand');
      ExitScript; // <  <  <  <  <  <  <  <  <  <  
    end;
end.


Thank you for making ReNamer.

 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB