Page 1 of 1

randomly rename documents - how to?

Posted: 22 Aug 2012 18:34
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...

Re: randomly rename documents - how to?

Posted: 22 Aug 2012 19:06
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++;
	}

Re: randomly rename documents - how to?

Posted: 22 Aug 2012 19:14
by tiago
Damn, boy, you've shuffled it using the formalist function 'x'?
I need to take a break. Seriously.
Many thanks, highend!

Re: randomly rename documents - how to?

Posted: 22 Aug 2012 19:37
by serendipity
Must easier would be:

Code: Select all

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