randomly rename documents - how to?

Discuss and share scripts and script files...
Post Reply
tiago
Posts: 589
Joined: 14 Feb 2011 21:41

randomly rename documents - how to?

Post by tiago »

I need help on this.
I need to rename items shuffling them randomly.
A basic "001.ext, 002.ext, 003.ext, ... (total amount of docs)" would do, but they need to be randomly renamed.
Help, please...
Power-hungry user!!!

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: randomly rename documents - how to?

Post by highend »

Code: Select all

$countSelected = get("CountSelected");
	$fileList = get("SelectedItemsPathNames", "|");
	$fileList = formatlist($fileList, "x", "|");
	$i = 1;
	while($i <= $countSelected) {
		$item = gettoken($fileList, $i, "|");
		rename b, format($i, "000"), , $item;
		$i++;
	}
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: randomly rename documents - how to?

Post by tiago »

Damn, boy, you've shuffled it using the formalist function 'x'?
I need to take a break. Seriously.
Many thanks, highend!
Power-hungry user!!!

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: randomly rename documents - how to?

Post by serendipity »

Must easier would be:

Code: Select all

  #331; /Random resort list
  rename b, '<#001>', ,,8;

Post Reply