Hi all my helping script Gurus friends !
I got from you, some years ago, a script that selected a file, changed the extension to .txt, moved it into a folder, then deleted the original file.
It work very well but now I am looking for the same thing but for a Folder
The script should do this
Take the name of the selected folder, create a .txt file and append 'FOLDER to it at the beginning of the name, move that .txt file to "F:\Dummy Files" and the delete the original folder and its content.
Here is the original script for Files to help you so you should only modify a few lines... :
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;
sel 1;
"_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";
moveto "F:\Dummy Files", $newFile;
Thank you in advance for your help
Create .txt file from a folder and move it to location
Re: Create .txt file from a folder and move it to location
Something like this?
Test it, before you use it with real data!
Test it, before you use it with real data!
Code: Select all
$dstPath = "F:\Dummy Files";
foreach($item, <get SelectedItemsPathNames <crlf>>, <crlf>, "e") {
if (exists($item) == 1) { continue; }
$dstFile = "$dstPath\FOLDER_" . gpc($item, "component", -1) . ".txt";
new($dstFile, "file");
delete 1, 0, $item;
}
One of my scripts helped you out? Please donate via Paypal
Re: Create .txt file from a folder and move it to location
Looks like it work perfectly as I wanted
THANK YOU VERY MUCH !!
THANK YOU VERY MUCH !!