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...
wipe multiple files
-
binocular222
- Posts: 1423
- Joined: 04 Nov 2008 05:35
- Location: Win11, Win10, 100% Scaling
Re: wipe multiple files
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
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
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
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
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
-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
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!!
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!!
-
highend
- Posts: 14942
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: wipe multiple files
It's stated clearly in the helpfile...
Read the help file for these commands!
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...Just as a reminder: You can also wipe whole folders. All files found within are individually wiped. Then the folders are removed.
Read the help file for these commands!
One of my scripts helped you out? Please donate via Paypal
-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
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\*.*")
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\*.*")
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: wipe multiple files
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.
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;
}-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
wow! now i have understand all!!
it's a little bit complicated, but work!
many thanks for your help!
it's a little bit complicated, but work!
many thanks for your help!
-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
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\*.*")
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\*.*")
-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
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;
}
"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;
}
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: wipe multiple files
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;
}-
swan_x
- Posts: 335
- Joined: 08 Oct 2009 12:27
Re: wipe multiple files
wow! great!
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!
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!
XYplorer Beta Club