Skip to content

Instantly share code, notes, and snippets.

@hokorobi
Created November 25, 2011 09:17
Show Gist options
  • Save hokorobi/1393107 to your computer and use it in GitHub Desktop.
Save hokorobi/1393107 to your computer and use it in GitHub Desktop.
PPx rename
//!*script
if ( PPx.DirectoryType == 96 || PPx.DirectoryType == 4 ) {
//UNxxx or listfile
PPx.Execute("%K\"@R\"")
} else {
if ( PPx.EntryFirstMark == 0 ) {
// マークがなかったらカーソルのエントリをリネーム。
if(PPx.Extract("%T")) {
newfile = PPx.Extract('%"名前変更"%{%|%X%|.%T%}');
} else {
newfile = PPx.Extract('%"名前変更"%{%|%C%|%}');
}
if (!newfile) {
// 未入力ならキャンセル。
PPx.Quit();
}
PPx.Execute('*rename %FC,' + newfile + ' %: *jumppath /refreshcache /entry:"' + newfile + '"')
} else {
// マークがあったら一括リネーム
if (PPx.EntryAttributes & 16) {
// マークの最初がディレクトリなら、ディレクトリをリネーム
option = ' /renamefile:off /renamedirectory:on '
} else {
option = ' /renamefile:on /renamedirectory:off '
}
// 一括リネーム後には refreshcache でソート状態で表示
PPx.Execute('*file Rename /name:%FCB' + option + '%Or- %: *jumppath /refreshcache /savelocate');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment