Copy files and disregard ext if already existing

This is a place for users to discuss Altap Salamander. Please feel free to ask, answer questions, and express your opinion. Please do not post problems, bug reports or feature requests here.
User avatar
McLion
Posts: 78
Joined: 26 Apr 2006, 17:54
Location: Switzerland

Copy files and disregard ext if already existing

Post by McLion »

Hi

Is there a way to have the copy dialog disregarding the file extension and just comparing the filename?
Example:
I have a lot of music files on my PC. Some as FLAC and some as MP3, and some even in both qualities. If they are available in both types, the filenames are identical. They sit in identical structures within only a different top-level folder: \MP3\.... and \FLAC\...
To copy them to my MediaServer I'd like to have the FLAC where available, and the MP3 where no FLAC is available.
It's easy to fist copy all the FLAC's. But now I need to copy from the MP3's only files where at the target location the folder\filename is not already existing: If filename.flac is existing, don't copy filename.mp3, otherwise copy it. This should then work for then entire tree.

Could not find an option for this. Any idea?
Thanks
McL
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Copy files and disregard ext if already existing

Post by SvA »

I don't think you can do this with what AS provides right now. Your use case is rather specialized and scarcely apt for general inclusion. However, you can use scripting to solve your issue.

The simplest approach was probably to first copy .flac and .mp3, then run a script that walks your library and deletes all .mp3 for which a matching .flac exists. The following .cmd-script will just do this.

Code: Select all

FOR /R %%F IN (*.mp3) DO (
  IF EXIST "%%~dpnF.flac" del %%F
)
Start this script in the root folder of your library.

For a more integrated approach, you can utilize the automation plugin. As a base you can take the "Count Lines.js" example script and basically exchange the function GetFileLinesCount for one that does a conditional copy.
fraktik
Posts: 209
Joined: 27 Apr 2007, 12:13
Location: cz
Contact:

Re: Copy files and disregard ext if already existing

Post by fraktik »

Sorry for bothering you but would it be possible to make from this next example in Automation Scripts thread please? So it could be easy to find (and apply) fort others...
User avatar
mdruiter
Posts: 262
Joined: 22 Feb 2006, 15:33
Location: Amsterdam, The Netherlands
Contact:

Re: Copy files and disregard ext if already existing

Post by mdruiter »

I could see use in an extra option for Find Duplicate Files: to ignore not the full Name but only the filename without extension. Then you could easily scan for duplicate filenames (modulo extension) and remove one of them. :idea:
Maybe you would need a way to quickly select every 'second' file of a duplicate pair, but that's a different story.
Post Reply