Page 2 of 2
Re: Please help I need a Script !
Posted: 15 Nov 2009 17:49
by jacky
Yes, I believe there was a syntax change, so regexreplace (among others) does now work as a function when () are used. So you need to replace a line such as this
Code: Select all
RegexReplace($files, $files, "^(.*);.*<crlf>", "$1|");
with e.g. this
Code: Select all
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
This should work:
Code: Select all
End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting "AllowRecursion", 1;
Sub "_newTXT";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,1,$files;
"_newTXT"
Global $files, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "txt");
New $newFile;
$i = $i + 1;
Sub "_newTXT";
Re: Please help I need a Script !
Posted: 15 Nov 2009 18:49
by Ysl
Thanks !
It almost work...
I get this error message
when the xxx.txt is already created but the xxx.mp3 is not yet deleted
File name lenght is "normal"
Ysl
Re: Please help I need a Script !
Posted: 25 Nov 2009 17:29
by Ysl
Ok, don't know why but now it works !
Thanks again !!
Ysl
Re: Please help I need a Script !
Posted: 11 Jul 2010 06:15
by SkyFrontier
I needed this to substitute *any* files for zero sized one.
That did the trick:
Code: Select all
End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting "AllowRecursion", 1;
Sub "_newTXT";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,1,$files;
"_newTXT"
Global $files, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "$ext");
New $newFile;
$i = $i + 1;
Sub "_newTXT";
Assigned SHIFT+1 to it under "User/Manage Commands/Run Script".
Problem: it renamed all zeroed files as "*file*-01.*ext*", due to collision name.
So I applied the following as SHIFT+2:
It does not affect folders or subfolders in a bad manner, just files - so I assume it's safe to use "#250-select all".
-Can I have a little help to have the same effect in a single stroke, by means of the script detecting files only by checking size of files, for instance, or another XY-way? I mean: the script could avoid name collision, plus more safely handling *files* only with value >0 (auto-selection of *all files only*), all in a single script?
-Can those resulting empty files have same attributes as their original counterparts?
Thank you!
Re: Please help I need a Script !
Posted: 31 Aug 2010 02:17
by SkyFrontier
This will:
-select *ALL* files only (not subfolders!) on a folder;
-*delete them all* without a prompt (unable to provide, people - sorry!);
-substitute all deleted files with zero-sized .txt files, replicating original file names plus extensions.
This is the hardest but closest way I got to accomplish my
Catalog Maker. Lacking system dates replication and auto-subfolders scan, is pretty useless as a Catalog Maker.
Feel free to contribute...
Code: Select all
sel f; End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting "AllowRecursion", 1;
Sub "_ZERO";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,1,$files;
sel f; //selects all files, no folders.
rename s, "-01/"
"_ZERO"
Global $files, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "$ext");
New $newFile;
$i = $i + 1;
Sub "_ZERO";
Re: Please help I need a Script !
Posted: 25 Mar 2012 12:22
by Ysl
Hi all my helping friends !
I do have again a problem with this script, maybe because of a new update.
End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting "AllowRecursion", 1;
Sub "_newTXT";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,0,$files;
"_newTXT"
Global $files, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "txt");
New $newFile;
$i = $i + 1;
Sub "_newTXT";
#1403
My problem is with command #1403 at the end of the script which is no more executed
#1403 is "Move to F:\Dummy Files"
Of course F:\Dummy Files exist and hadn't been changed.
So now the file is created as an .txt by the script but is not moved anymore to the F:\Dummy Files folder
Maybe there is another way to move the created .txt files by the script to that folder instead of using the #1403 command ?
Thanks for your help !
Ysl
Re: Please help I need a Script !
Posted: 25 Mar 2012 12:55
by highend
Replace the line that contains "#1403" with
Re: Please help I need a Script !
Posted: 25 Mar 2012 16:24
by Ysl
Thanks ! Works fine for me !
Re: Please help I need a Script !
Posted: 25 Mar 2012 18:42
by j_c_hallgren
Ysl wrote:I do have again a problem with this script, maybe because of a new update.
Please do all respondents a favor and always enclose any script code in "Code" tags...reading it otherwise is difficult at times.