rename file with random character
Re: rename file with random character
don't work. I'm not stupid. I tried, obviously, before posting.
if i select a list of files, and run the script, only the first name in the list is changed...
if i select a list of files, and run the script, only the first name in the list is changed...
Re: rename file with random character
Well that's impossible. How are you running the script?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: rename file with random character
i have saved your script on new command from “manage command - script”.
then i select my list of files, run script, but only the first file change name...
then i select my list of files, run script, but only the first file change name...
Re: rename file with random character
Hang on. You select a list of files, meaning you select ONE file which CONTAINS a list of files?
Then try this version of the script, now updated to use get('rs'):Although note that there might be a little issue with renames: viewtopic.php?f=2&t=19956
Then try this version of the script, now updated to use get('rs'):
Code: Select all
"RenameRandom from Filelist : renamerandom_filelist"
// Renames current selected items to random names.
/*** user-configurable options ***/
$report = 1; /* whether to generate a report of renames; 1 or 0 */
$maxLen = 16; /* max length of name; 0 < $maxLen < 256 */
$minLen = 8; /* min length of name; 0 < $minLen <= $maxLen */
$pool = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=+_'@$%&^~*#[](),.";
// $pool = character pool for generating random names
/*** end of user-configurable options ***/
setting 'BackgroundFileOps', 0;
$pool = replacelist($pool, '\/:*?"<>|', ''); // remove disallowed characters
$len = gettoken($pool, 'count', ':'); // length of character pool
$maxLen = ($maxLen > 255) ? 255 : $maxLen ; // sanitize max length
$minLen = ($minLen < 1) ? 1 : $minLen ; // sanitize min length
$maxLen = ($maxLen < $minLen) ? $minLen : $maxLen ; // sanitize min-max length range
if $report { $report = ''; } else { unset $report; } // init reporting
// $sel = get("SelectedItemsPathNames", '|'); // items to rename, current selection
$sel = formatlist(replace(readfile(<curitem>), <crlf>, '|'), 'e'); // items to rename, current selection
$maxNameLen = 0;
foreach ($item, $sel) { // get length of longest itemname in $sel
$itemNameLen = strlen(gpc($item, 'file'));
$lastMaxLen =($itemNameLen > $lastMaxLen) ? $itemNameLen : $lastMaxLen;
$maxNameLen = $lastMaxLen;
}
foreach ($item, $sel) {
$randName = gpc($item, 'file');
while exists(gpc($item, 'path') . '\' . $randName) { // generate a unique random name
$randLen = rand($minLen, $maxLen); // random name length for current loop item
$randName = get('rs', $randLen, $pool); // generate a random name
}
$randName = renameitem($randName, $item, 3); // perform the rename
wait 1;
if isset($report) { // generate report
$oldName = gpc($item, 'file');
$report = $report . $oldName .
strrepeat(' ', $maxNameLen-strlen($oldName)) . " -> " .
$randName . <crlf>;
}
}
if isset($report) { text $report; } // display report if available
status "RenameRandom: finished";
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: rename file with random character
@ admin
i've try your latest beta and work very fine with batch rename:
<get rs 8 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789>
but how to remove estension on the new file name??
i've try your latest beta and work very fine with batch rename:
<get rs 8 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789>
but how to remove estension on the new file name??
Re: rename file with random character
@ SammaySarkar
i've try your latest script, but after select my all files, then run your script from "Script - run script" i have one error... see attach
i've try your latest script, but after select my all files, then run your script from "Script - run script" i have one error... see attach
- Attachments
-
- Appunti01.jpg (36.24 KiB) Viewed 1542 times
Re: rename file with random character
on continue script i have a new error
- Attachments
-
- Appunti01s.jpg (36.3 KiB) Viewed 1542 times
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: rename file with random character
Look at my post again... viewtopic.php?p=166223#p166223
FAQ | XY News RSS | XY Twitter
Re: rename file with random character
@ admin
oh yeeeesss!! now really work fine! tnxs
oh yeeeesss!! now really work fine! tnxs
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: rename file with random character
Remains the question: Why are you doing this randomizing of filenames?
FAQ | XY News RSS | XY Twitter
Re: rename file with random character
for hide some files.
and more, i want rename some files before move to recycle, so as not to be recovered later with professional prog, ex Recoverit or EaseUS Data Recovery Wizard.
and more, i want rename some files before move to recycle, so as not to be recovered later with professional prog, ex Recoverit or EaseUS Data Recovery Wizard.
Re: rename file with random character
and why, see my post above, i have 2 error on script of SammaySarkar??
Re: rename file with random character
Because you still need to select a file containing the list of files to rename, duh.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: rename file with random character
@ sammay
<you still need to select a file containing the list of files to rename>
i don't want this. i don't have a file containing the list of files to rename... i have some files on my folder and i want rename it...
@ admin
if i want assign shortcut (ex ALT+M) to batchrename funcion:
<get rs 8 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789> /e
how to this??
<you still need to select a file containing the list of files to rename>
i don't want this. i don't have a file containing the list of files to rename... i have some files on my folder and i want rename it...
@ admin
if i want assign shortcut (ex ALT+M) to batchrename funcion:
<get rs 8 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789> /e
how to this??
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: rename file with random character
Check out User / Rename ... (via User | Manage Commands...)
FAQ | XY News RSS | XY Twitter