mIRC Home    About    Download    Register    News    Help

Print Thread
N
nataliad
nataliad
N
in dcc options there is no option to auto-rename when file already exists

its a major lack

D
DaveC
DaveC
D
Script it by...
(1) direct the new file to a new folder
or
(2) rename the original file
or
(3) using a bit of a cludge solution it is possable trick mirc into renaming the incoming file, how ever there are side effects

N
nataliad
nataliad
N
umm how can I start to script such thing?

do you have something specific in mind?

it would be nice to be posted in a repository, others may find it useful

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
I've never tried doing something like this before, but this seems to work. Set yourself to overwrite existing files and try this code out. Just have someone send you a small text file once, then another one with the same filename and different text in it. Verify that they are different in your download folder afterwards. The original will now have _2 in the filename. Note that this is just a basic script and isn't designed to handle when you already have a _2 file.

Code:
ctcp *:DCC Send *:*:{ 
  if ($exists($filename)) { 
    var %ext = $gettok($filename,$gettok($filename,0,46),46)
    rename $filename $remove($filename,. $+ %ext) $+ _2. $+ %ext
  }
}


So...

filename.txt is in your download folder and someone sends another filename.txt to you. the original is renamed to filename_2.txt and the new one is named filename.txt. It shouldn't be too difficult to have it check prevent problems when a _2 is already there. I just don't have time to mess around with it right now.

D
DaveC
DaveC
D
actually theres an option (4) as well i forgot about, but only if this is a problem because your getting dupliicate file names from different people which are different files.

aka Bob sends you HELP.TXT at 13k about helping make balloon animals
and Bill sends you Help.txt at 56k about help to fix punchers in a tire

Then u can set the mirc option to download files into folders based on there nick.

/tools/options/dcc/folders/select a type/edit/sort files by nickname info own folders/TICK

then you can download same filename from multiple people and even resume them if the download fials, and it well resume the right file.


Link Copied to Clipboard