|
alkahol1k
|
alkahol1k
|
Is it possible to rename all files in one folder? If so i'd like to take a certain string out for example "-abc'. Would this freeze my mirc and computer ?
|
|
|
|
Joined: Nov 2003
Posts: 2,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
.echo -q $findfile(folder,*.*,0,.rename $1- $remove($1-,-abc))
|
|
|
|
alkahol1k
|
alkahol1k
|
That returns '399' which is how many files i have in that folder
|
|
|
|
alkahol1k
|
alkahol1k
|
If i had
textfile1-abc.txt textfile2-abc.txt textfile3-abc.txt picture-abc.jpeg
how do i rename them all in one step while taking out just '-abc' in all 4 files
|
|
|
|
Joined: Nov 2003
Posts: 2,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
Have you even tried it?
Here's an example:
//write a-abc.txt | write b-abc.txt | write c-abc.txt | .echo -q $findfile($mircdir,*.*,0,.rename $+(",$1-") $remove($+(",$1-"),-abc))
|
|
|
|
TonyTheTiger
|
TonyTheTiger
|
he probably already renamed them when he tried it lol. maybe should've made it rename instead of .rename so he could see it happening.
|
|
|
|
alkahol1k
|
alkahol1k
|
yeah that worked out great, the problem i could see happening is if there was lets say 2000 files in the folder it might freeze
|
|
|
|
Joined: Mar 2003
Posts: 37
Ameglian cow
|
Ameglian cow
Joined: Mar 2003
Posts: 37 |
In a situation like that, I would think he would put something like, "Renaming files... please be patient." and then "Done." when the renaming is complete. Sure, it'll lock up the system, but the only other way I know to do it quicker is to use a DLL, but still you're going to have a few seconds of freezing on a long file list.
|
|
|
|
Joined: Dec 2002
Posts: 1,893
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,893 |
$dllcall() might come in handy
|
|
|
|
alkahol1k
|
alkahol1k
|
what dll would you be using for that ?
|
|
|
|
Joined: Dec 2002
Posts: 1,893
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,893 |
There are some filesystem dlls at mircscripts.org, but as far as I know none of them support mass-renaming. I would stick to $findfile().
|
|
|
|
alkahol1k
|
alkahol1k
|
i'm curious as to why you suggested $dllcall then
|
|
|
|
CtrlAltDel
|
CtrlAltDel
|
Why not use an external application like DMEXMenu (free) or the inexpensive ($15 USD) Better File Rename ? Neither of which takes more than 10 seconds when changing the names of over 10,000 files on my computer (thus no noticable freeze/lockup). The latter will change folder names, as well as sub folders and files.
|
|
|
|
Joined: Dec 2002
Posts: 1,893
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,893 |
i'm curious as to why you suggested $dllcall then It was in reply to cgfiend, who said that even when you use a DLL you'll have to bear a mIRC freeze. This would be true if you were to use $dll(), but now $dllcall() allows you to run the DLL in a separate thread and let mIRC continue normally. For example, $dllcall(file.dll, [color:blue]mass_ren_done, MassRename, c:\folder\)[/color] would return immediately to the script, leaving the renaming process in the background. When it's done, mIRC will call the custom alias you specified, "mass_ren_done".
|
|
|
|
alkahol1k
|
alkahol1k
|
thanks for the help
above tidy_trax posted a helpful alias but what if i'd just like to remove the '-abc' and not add a "." Is this possible ?
|
|
|
|
Iori
|
Iori
|
Use your OS  Here's an NT solution, I don't know 9x syntax for this. ;p alias renall {
if !$isdir($2-) { echo -a * /renall <string> <path> | return }
var %a = $1,%b
.fopen -no renall renall.cmd
if !$ferr { %b = $findfile($2,$+(*,%a,*),0,renal $+(%a,;,$1-)) }
.fclose renall
if $file(renall.cmd) { run -n renall.cmd | echo -a * Renaming %b files. }
.timerrenall 1 5 .remove renall.cmd
}
alias -l renal {
tokenize 59 $1-
.fwrite -n renall rename $+(",$2," ",$remove($nopath($2),$1),")
} Example: /renall -abc X:\path\to\files
|
|
|
|
|