What is the best way to set multiple directories to combine into one large directory?

English Support for Syncovery on Windows.
Post Reply
Iodine
Posts: 6
Joined: Sat Jun 29, 2024 1:16 am

What is the best way to set multiple directories to combine into one large directory?

Post by Iodine »

Hello, I have 6 directories that I need to combine into one super directory. Basically, we have 6 old storage servers and we are combining all of the assets from all of them into one new storage server.

A few of the folders and files may have matching names, but every piece of data is considered unique and I don't want anything to be over-written or combined. If possible, when a folder is already present in the destination directory, I would like the incoming folder with the same name to rename itself. What's the best way to set this up?



An example would be something like:


Directory 1:
Folder 1
Folder 2
Folder 3


Directory 2:
Folder 3
Folder 4
Folder 5

Directory 3:
Folder 5
Folder 6
Folder 7


All of these are moved to:

Final Destination Directory:
Folder 1
Folder 2
Folder 3
Folder 3 (Renamed due to conflict)
Folder 4
Folder 5
Folder 5 (Renamed due to conflict)
Folder 6
Folder 7





This way, I would not lose any data when combining all of the directories. What's the best way to set this up? Thanks in advance, syncovery is a great program
tobias
Posts: 1948
Joined: Tue Mar 31, 2020 7:37 pm

Re: What is the best way to set multiple directories to combine into one large directory?

Post by tobias »

Hello,
currently, Syncovery does renaming for conflicts only on a file level, not folder.

But it can probably be implemented with a custom script.

I assume you would need it for files too, not just for folders?
Iodine
Posts: 6
Joined: Sat Jun 29, 2024 1:16 am

Re: What is the best way to set multiple directories to combine into one large directory?

Post by Iodine »

The main need is for folders to be renamed, as identically named folders may exist on multiple source drives, but contain unique files.

Renaming files is less important since each file would exist in its own unique directory in which there is no conflict to begin with.

Barring the above, is there a way to trigger the logs to make a report of all the naming conflicts so I can rename them manually and move them manually?
tobias
Posts: 1948
Joined: Tue Mar 31, 2020 7:37 pm

Re: What is the best way to set multiple directories to combine into one large directory?

Post by tobias »

Hi,
thanks for your reply! The easiest will actually be the automatic renaming of folders.

Is this really what you want to add to the folder names?
" (Renamed due to conflict)"

And what if the same folder exists more than twice?

I'll write the script for you on Wednesday.
Iodine
Posts: 6
Joined: Sat Jun 29, 2024 1:16 am

Re: What is the best way to set multiple directories to combine into one large directory?

Post by Iodine »

Hi Tobias, thank you for replying. I think the best naming structure would simply be to append a _1 or _2 or _3 to iterations that have the similar name.

So if there were Four folders called "Ambition" they would look like this:

Ambition
Ambition_1
Ambition_2
Ambition_3

This would allow them to nest directly next to each other in the directory, and it would be relatively easy for our operators to go into the directory and see at a glance what needs to be fixed manually.

That being said, I am not really picky about the verbiage, but I think that this approach solves the issue of more than 1 naming conflict.

Thank you Tobias for being so responsive and helpful.
Iodine
Posts: 6
Joined: Sat Jun 29, 2024 1:16 am

Re: What is the best way to set multiple directories to combine into one large directory?

Post by Iodine »

I should add that this renaming should not apply to subfolders if possible, since almost every job would have a "Mezz Package" folder, or an "Art" folder, or an "iTunes" folder. These subfolders would not need to be renamed because they are differentiated by their top level folder, which has a unique name.
tobias
Posts: 1948
Joined: Tue Mar 31, 2020 7:37 pm

Re: What is the best way to set multiple directories to combine into one large directory?

Post by tobias »

Hello,
this is the PascalScript you need. It can be added to the profile via the "PascalScript..." checkbox on the "Job" tab sheet.

Just copy and paste the whole script text into the dialog box.

Also remember to remove the checkmark "Detect Moved Files".

Each source server can be copied only once. If you copy it another time, you will get only folders with numbers added, because the folders already exist.

Therefore, interrupting or failing is not an option. The whole copy must succeed in a single operation. You can however use the Pause button to pause the job.

The Sync Operating Mode should be Standard Copying.

Code: Select all

function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
        const isFolder: Boolean):UnicodeString;
var Addend,RightPath,TryPath:UnicodeString;
    Loop:Integer;
begin
  Result:=FileName
  if not isFolder or (CurrentSubPath>'') then 
     Exit;

  RightPath:=ConcatPathWithDelim(
                ConcatPathWithDelim(RightBasePath,CurrentSubPath,PathDelim),
                FileName,PathDelim);

  if not EntryExists(RightPath) then 
     Exit;

  for Loop:=1 to 1000 do begin
    Addend:='_'+IntToStr(Loop);
    TryPath:=RightPath+Addend;
    if not EntryExists(TryPath) then begin
       Result:=FileName+Addend;
       Exit;
       end;
    end;
  end;
Post Reply