Re-naming all files in a folder?
#92655
03/08/04 04:31 PM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
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 ?
|
|
|
Re: Re-naming all files in a folder?
#92656
03/08/04 04:39 PM
|
Joined: Nov 2003
Posts: 2,327
tidy_trax
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
.echo -q $findfile(folder,*.*,0,.rename $1- $remove($1-,-abc))
New username: hixxy
|
|
|
Re: Re-naming all files in a folder?
#92657
03/08/04 04:51 PM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
That returns '399' which is how many files i have in that folder
|
|
|
Re: Re-naming all files in a folder?
#92658
03/08/04 04:53 PM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
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
|
|
|
Re: Re-naming all files in a folder?
#92659
03/08/04 05:04 PM
|
Joined: Nov 2003
Posts: 2,327
tidy_trax
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
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))
New username: hixxy
|
|
|
Re: Re-naming all files in a folder?
#92660
03/08/04 05:44 PM
|
Joined: Feb 2004
Posts: 124
TonyTheTiger
Vogon poet
|
Vogon poet
Joined: Feb 2004
Posts: 124 |
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.
|
|
|
Re: Re-naming all files in a folder?
#92661
03/08/04 07:04 PM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
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
|
|
|
Re: Re-naming all files in a folder?
#92662
03/08/04 07:57 PM
|
Joined: Mar 2003
Posts: 37
cgfiend
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.
|
|
|
Re: Re-naming all files in a folder?
#92663
04/08/04 12:51 AM
|
Joined: Dec 2002
Posts: 1,922
Online
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
$dllcall() might come in handy
|
|
|
Re: Re-naming all files in a folder?
#92664
04/08/04 12:56 AM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
what dll would you be using for that ?
|
|
|
Re: Re-naming all files in a folder?
#92665
04/08/04 01:21 AM
|
Joined: Dec 2002
Posts: 1,922
Online
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
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().
|
|
|
Re: Re-naming all files in a folder?
#92666
04/08/04 03:18 AM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
i'm curious as to why you suggested $dllcall then
|
|
|
Re: Re-naming all files in a folder?
#92667
04/08/04 01:18 PM
|
Joined: Jun 2003
Posts: 994
CtrlAltDel
Hoopy frood
|
Hoopy frood
Joined: Jun 2003
Posts: 994 |
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.
I refuse to engage in a battle of wits with an unarmed person.
|
|
|
Re: Re-naming all files in a folder?
#92668
04/08/04 04:09 PM
|
Joined: Dec 2002
Posts: 1,922
Online
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
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".
|
|
|
Re: Re-naming all files in a folder?
#92669
05/08/04 01:29 AM
|
Joined: Nov 2003
Posts: 257
alkahol1k
OP
Fjord artisan
|
OP
Fjord artisan
Joined: Nov 2003
Posts: 257 |
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 ?
|
|
|
Re: Re-naming all files in a folder?
#92670
05/08/04 02:05 AM
|
Joined: Aug 2003
Posts: 1,831
Iori
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
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
|
|
|
|
|