Page 1 of 1

wipe multiple files

Posted: 28 Jan 2014 17:33
by swan_x
hi, i have 3 files in one folder. i want wipe all files...i try this:
wipe "C:\blablabla\*.*"
but wiping failed! why???
and the same with *.txt (3 file are 3 .txt)

work with delete command: delete "C:\blablabla\*.*" but not with wipe...

Re: wipe multiple files

Posted: 28 Jan 2014 18:05
by binocular222
Help file:
Syntax

wipe [itemlist]

itemlist |-separated list of items (full path) to delete. The | (pipe) respectively the items may be surrounded by any number of blanks.
Defaults to the selected items in list.

Examples
wipe; // wipe all selected items in the file list
wipe "E:\Test\1.txt|E:\Test\2.txt"; // wipe two particular files

Re: wipe multiple files

Posted: 28 Jan 2014 18:25
by swan_x
ok tnxs, i have read the help file before posting my answer, but i have one problem:
this files on my folder (1 or more files txt) have different name any time i used one another program. I'll explain.
i use one app. this app write one file each time i used this app (log files). any file have name with date (Log_2014-01-27_1.txt, Log_2014-01-29_1.txt)
It is not possible write on script the name for one single file, every time i used this app, the name of single file change!

i want wipe all files (*.*) or any .txt files (*.txt).
the script work with "delete" command, but not with "wipe" command :(

Re: wipe multiple files

Posted: 28 Jan 2014 23:56
by swan_x
io have one file abc.txt on C:
and on folder "logo" on C: i have 1 or 2 or 5 or 7 files txt (ex. log_2014_28.txt; log_2014_25.txt; log_2014_13.txt)
i want wipe abc.txt on C: and all files txt on my folder "logo"

this is my script:
wipe "C:\abc.txt|C:\logo\*.*"
this script wipe correctly abc.txt on C: but nothing on C:\logo
if i try wipe "C:\abc.txt"; delete "C:\logo\*.*" this work correctly....but i want wipe all!!

Re: wipe multiple files

Posted: 29 Jan 2014 00:42
by highend
It's stated clearly in the helpfile...
Just as a reminder: You can also wipe whole folders. All files found within are individually wiped. Then the folders are removed.
So you either wipe the whole folder and recreate it afterwards or you use a foreach loop / listfolder / folderreport command to create a | separated list from the files in that folder and pass it to the wipe command...

Read the help file for these commands!

Re: wipe multiple files

Posted: 29 Jan 2014 10:07
by swan_x
sorry, i have understand little bit!
you say wipe all files on folders and recreate this folder after, right?
it's not possible simple wipe all files in the folder?
otherwise i used delete 0, 0

Please write a concrete example (ex. wipe "C:\abc.txt|C:\logo\*.*")

Re: wipe multiple files

Posted: 29 Jan 2014 16:02
by TheQwerty
The problem is the wipe command does not support wildcards, only a |-separated list of full paths.

This means your script first needs to create a list of items in the folder.

Code: Select all

"Wipe C:\blablabla\"
  // Folder to clean.
  $folder = 'C:\blablabla\';

  // Lists all files in the folder - change 1 to 0 to wipe folders as well.
  $list = ListFolder($folder, '*', 1, '|');

  // Only perform the wipe if an item was found.
  // Otherwise the wipe will use the current selection.
  if ($list != '') {
    Wipe $list;
  }

Re: wipe multiple files

Posted: 29 Jan 2014 17:09
by swan_x
wow! now i have understand all!!
it's a little bit complicated, but work!
many thanks for your help!

Re: wipe multiple files

Posted: 29 Jan 2014 17:26
by swan_x
ok now the folder is empty!
but i have another single file on C:\ (C:\abc.txt)
i want (one shot) delete all file on folder blablabla (and this its ok) and wipe single file on C:

please...complete the script!
(this my old script, view my old post up...."wipe "C:\abc.txt|C:\logo\*.*")

Re: wipe multiple files

Posted: 29 Jan 2014 20:24
by swan_x
i try this but not work correctly...this wipe all files on folder, but not wipe single file abc.txt...

"wipe C:\abc.txt|C:\blablabla"
// Folder to clean.
$folder = 'C:\blablabla';

// Lists all files in the folder - change 1 to 0 to wipe folders as well.
$list = ListFolder($folder, '*', 1, '|');

// Only perform the wipe if an item was found.
// Otherwise the wipe will use the current selection.
if ($list != '') {
Wipe $list;
}

Re: wipe multiple files

Posted: 29 Jan 2014 21:21
by TheQwerty

Code: Select all

"Wipe swan_x's stuff..."
	// |-separated list of file(s) to remove.
	$files = 'C:\abc.txt';

	// |-sepearated list of folder(s) to clean.
	$folders = 'C:\blablabla\';

	// Set to True to only remove files from the folders.
	// Set to False to remove subfolders as well.
	$onlyFiles = True;


	// END OF OPTIONS


	// Be forgiving in our inputs by accepting ';' or '|'.
	$files = Replace($files, ';', '|');
	$folders = Replace($folders, ';', '|');

	// Initialize list.
	$list = '';

	// Loop through list of folders.
	foreach ($folder, $folders, '|')
	{
		// Ignore empties...
		if ($folder == '') { continue; }

		// Ignore folders which do not exist.
		if (Exists($folder) == 2)
		{
			// Add folder's contents to list.
			$list = $list . '|' . ListFolder($folder, '*', $onlyFiles, '|');
		}
	}

	// Loop through list of files.
	foreach ($file, $files, '|')
	{
		// Ignore empties...
		if ($file == '') { continue; }

		// Ignore files which do not exist.
		if (Exists($file) == 1) {
			// Add files to list.
			$list = "$list|$file";
		}
	}

	// Clean up the list to remove empties and duplicates.
	$list = FormatList($list, 'dents');

	// Only perform the wipe if list is not empty.
	// Otherwise the wipe will use the current selection.
	if ($list != '') {
		Wipe $list;
	}

Re: wipe multiple files

Posted: 30 Jan 2014 00:05
by swan_x
wow! great! :appl:
and this only for wipe command...! with delete command it's very easy (also for me!)
many thanks for your help! now (i think) we really finished! :lol: