rejetto forum

Autorename of duplicate files

Caco · 28 · 14684

0 Members and 1 Guest are viewing this topic.

Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Guys, i think all this doesn't resolve my issue, cause even if i shorten the filename file(1).txt, next time HFS will look up for file (1).txt  :D


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
TO rejetto:

son problème est là où l'espace est en trop
Quote
 while fileExists(data.uploadDest) do
    begin
    inc(i);
    data.uploadDest:=format('%s\%s (%d)%s', [f.resource, fn, i, ext]);
    end;

à toi de définir si on doit retirer l'espace ou alors le remplacer par un  '_'
Quote
 while fileExists(data.uploadDest) do
    begin
    inc(i);
    data.uploadDest:=format('%s\%s_(%d)%s', [f.resource, fn, i, ext]);
    end;
« Last Edit: May 27, 2009, 12:04:03 PM by mars »


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
I roughly understand what you wrote, but if you write in english is better  ;D


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Guys, i think all this doesn't resolve my issue, cause even if i shorten the filename file(1).txt, next time HFS will look up for file (1).txt  :D

   
No, you misunderstood.
The solution given by mars, simply removes the space in the file name:

' (' By '('

eg:
file (1).txt > file(1).txt

file (2).txt > file(2).txt

So this solution must work.

****************************************
The post in french is for rejetto... it concerns the programming of hfs.


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
No , i didn't misunderstood. It's just like rejetto explained before:

Quote
this solution does not work very well.
because it renames " (1)" to "_(1)".
next time, HFS will give again " (1)" because there's no file with such name.
and again, the script will try to rename it to "_(1)", but this one already exists.
the result is: the second time the file is not renamed.

So the result is

file.ext

file(1).ext

file (1).ext

file (2).ext

and so on.

I hate spaces!  >:(


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Where i can find the complete list of all hfs events?  :'( (maybe with description)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i will write a better script asap, in the while you should answer these questions :P

what's in your system that doesn't support space in file names?
did you try surrounding with "double quotes" ?



Where i can find the complete list of all hfs events?  :'( (maybe with description)

menu > help > full guide
http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Well, actually my hfs.events is:

[+upload completed]
{.exec|cmd.exe /K mencoder %item-resource% -o %folder-resource%\[previews]\%item-name%.flv -of lavf -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=256:mbd=2:trell:last_pred=1.}

And works. Well, to be honest i cannot cut the /K parameter and tons of cmd remains open, but... ;D

Quoting and spaces make this no longer work.

In addition, i already told my mates to save their file with underscore, if i revert they will kill me  ;D


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Can you add [on file deletion]?

I explain you why.

You know i store previews in [previews] subfolder , i integrate the modifications made by French Can Can to add "delete" options to RAWR template. Now i had to intruct HFS not only to delete file on request, but also the related preview  ;)

I know i'm asking you much, and i would like to donate, but i can't do it via Internet. Is there any other way to do it? (al limite ti faccio un bonifico o un vaglia :P)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Quoting and spaces make this no longer work.

i think you misunderstood.
use "%item-resource%" instead of %item-resource%.
on command line, file with spaces must be quoted.

ok, i will add an event for deletion.

se clicki donate ottieni già le informazioni per il bonifico :)
comunque non ti preoccupare, una donazione fa sempre piacere, ma non è certo per soldi che do l'assistenza, altrimenti non ti basterebbero €100 :D


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Quote
use "%item-resource%" instead of %item-resource%.

No i understood but... OMFG i never imagined that it could work, indeed it works!!!  ;D

I would expect "mencoder error: could not find file %item-resource%". Shit! I must remember to always do ALL tests! Now it will be hard to tell my mates "ehm...remember i told you to put underscores instead of spaces? Now put back spaces instead of underscores"  :-[ ;D

Quote
ok, i will add an event for deletion.

Thank you VERY much ^_____^

Quote
se clicki donate ottieni già le informazioni per il bonifico

Ah! Non avevo mai cliccato perchè pensavo fosse solo PayPal!

No, tranquillo non sto cercando di "comprarti" l'asistenza, voglio farti una donazione perchè mi piace il tuo software e perchè sei disponibile nell'assistenza  ;D ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
you can use a tool to rename all underscores with spaces in the files you already got.
it takes seconds.


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
Yes , i know. Computers don't complain, people often do.  ;D