hello sir,
i want to rename only all file names not extensions in the folder with text file containg names.
example : folder has files unnamed.mp4, unnamed 1.mp4 and unnamed 3.mp4
text file has contents as
grammar usage
verb basics
all about modals
is it possible with script?
renaming files with text file contents
Re: renaming files with text file contents
files should be named in chronological order.
after execution of script, file names should be
grammar usage.mp4
verb basics.mp4
all about modals.mp4
after execution of script, file names should be
grammar usage.mp4
verb basics.mp4
all about modals.mp4
Re: renaming files with text file contents
Code: Select all
$txt = inputfile(<curpath>,, "Select file with expected filenames");
$dir = inputfolder(<curpath>, "Select folder with files to rename");
tab("new", "$dir");
sortby "m", "a"; //sort by modified, descending
$names = replace(formatlist(readfile($txt), 'et', <crlf>), <crlf>, "|");
$items = listpane('a', "*.mp4", 1+4, "|");
rename "l", $names, "p", $items;
It asks you to first select a txt file containing expected file names per line, and then to select the folder that contains the mp4 files.
then it opens a tab to that folder, sorts files by Modified, Ascending, (ie, the lastest modified file is at the bottom), and renames serially according to the txt content. You will get a prompt before the rename is applied.
To sort descending (so that latest files are at the top), change the "a" in
sortby "m", "a";
to a "d".To sort by created date instead of modified, change the "m" in
sortby "m", "a";
to a "c".No validation is done on the text content. You should make sure the text file only contains valid file names without duplication or other issues.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: renaming files with text file contents
This can be done also without scripting.
Sort your files chronologically and select them.
Then File>Rename Special>Edit Item Names... and paste text file contents to the box. Rename.
After that: File>Rename Special>Set Extension... mp4.
Sort your files chronologically and select them.
Then File>Rename Special>Edit Item Names... and paste text file contents to the box. Rename.
After that: File>Rename Special>Set Extension... mp4.
Re: renaming files with text file contents
thanks a lot. both the code and non script solutions are working fine.