How to Escape a Dash
Posted: 15 Sep 2015 06:56
How do I escape a dash so that it appears in the file name as a dash and it doesn't behave as an operator?
I have the following script:
It reaches into a sub-subfolder, and moves the files to the folder above, deletes the sub-subfolder, and then renames the moved files.
Is there a more elegant way to get the dash to appear in the renaming than how I got it to work?
I tried using single quotes in various areas, but the quotes were appearing in the file name.
Thank you.
I have the following script:
Code: Select all
foreach($folder, folderreport(dirsrel, r, , , , "|"), "|", , ) {
if (foldersize("<curpath>\$folder", <d>, 0)>0) {
$subfolder = folderreport(dirsrel, r, "<curpath>\$folder", , , "|");
moveto "<curpath>\$folder", "<curpath>\$folder\$subfolder\*.*";
delete 0, 0, "<curpath>\$folder\$subfolder\";
$dash = -;
rename b, $folder $dash <#01>, , folderreport(files, r, "<curpath>\$folder", , , "|");
}
}Is there a more elegant way to get the dash to appear in the renaming than how I got it to work?
I tried using single quotes in various areas, but the quotes were appearing in the file name.
Thank you.