Author Topic: Autorename of duplicate files  (Read 7550 times)

0 Members and 1 Guest are viewing this topic.

Offline Caco

  • Tireless poster
  • ****
  • Posts: 113
    • View Profile
Re: Autorename of duplicate files
« Reply #15 on: May 27, 2009, 11:44:10 AM »
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: 1899
    • View Profile
Re: Autorename of duplicate files
« Reply #16 on: May 27, 2009, 11:55:01 AM »
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
Re: Autorename of duplicate files
« Reply #17 on: May 27, 2009, 11:57:33 AM »
I roughly understand what you wrote, but if you write in english is better  ;D

Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
  • Posts: 1243
  • ....... chut ! shh!
    • View Profile
Re: Autorename of duplicate files
« Reply #18 on: May 27, 2009, 12:28:49 PM »
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
Re: Autorename of duplicate files
« Reply #19 on: May 27, 2009, 12:54:29 PM »
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
Re: Autorename of duplicate files
« Reply #20 on: May 27, 2009, 01:51:39 PM »
Where i can find the complete list of all hfs events?  :'( (maybe with description)

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Autorename of duplicate files
« Reply #21 on: May 27, 2009, 02:45:42 PM »
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
Re: Autorename of duplicate files
« Reply #22 on: May 27, 2009, 03:53:51 PM »
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
Re: Autorename of duplicate files
« Reply #23 on: May 27, 2009, 04:05:49 PM »
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: 12953
    • View Profile
Re: Autorename of duplicate files
« Reply #24 on: May 27, 2009, 04:42:16 PM »
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
Re: Autorename of duplicate files
« Reply #25 on: May 27, 2009, 05:16:30 PM »
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: 12953
    • View Profile
Re: Autorename of duplicate files
« Reply #26 on: May 27, 2009, 05:31:07 PM »
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
Re: Autorename of duplicate files
« Reply #27 on: May 28, 2009, 09:44:47 AM »
Yes , i know. Computers don't complain, people often do.  ;D