Is there a way I can specify file/sub-directory names to be ignored when copying a directory?
I use Delphi and it creates a __history directory in each project directory and I'm fed up of having to delete them manually after I copy to backup
Ignore on copy
-
nas8e9
- Posts: 2232
- Joined: 21 Jun 2008 14:50
Re: Ignore on copy
Perhaps apply a Visual Filter to the directory first (excluding __history folders) (Views > Current Tab > Set Visual Filter) or alternatively, performing a search (Info Panel > Find Files) so that only the folders you want to copy are displayed before selecting them for copying?roy.lambert wrote:Is there a way I can specify file/sub-directory names to be ignored when copying a directory?
I use Delphi and it creates a __history directory in each project directory and I'm fed up of having to delete them manually after I copy to backup
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: Ignore on copy
If you copy manually, you can deselect that directory to prevent it from being copied. If you use a script to copy, you can specify that a particularly-named directory is to be deleted on completion of a copy job 
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: Ignore on copy
Hi roy.
See the wiki how to use an script: http://88.191.26.34/XYwiki/index.php/Scripting
You can e.g. create an button to execute this script.
If you need more comfort like folder-selecting-dialog or like this... just ask and someone will help you.
.
You can simple use xcopy:roy.lambert wrote:Is there a way I can specify file/sub-directory names to be ignored when copying a directory?
I use Delphi and it creates a __history directory in each project directory and I'm fed up of having to delete them manually after I copy to backup
Code: Select all
/*
Settings explanation:
$XcopyExcList: contents to exclude, one per line, see e.g. http://commandwindows.com/xcopy.htm
$SourceFolder: top folder with content to copy
$TargetFolder: backup folder to copy to
Open an DOS-Box and type in 'xcopy /?' to read the syntax.
*/
//no path with spaces here!!! you can't use quotes for the xcopy EXCLUDE parameter:
$XcopyExcListFile = "C:\TEMP\XcopyExcList.txt";
//$XcopyExcList = "\__history\<crlf>second pattern<crlf>third<crlf>.tmp<crlf>.bak";
$XcopyExcList = "\__history\";
writefile($XcopyExcListFile, $XcopyExcList);
$SourceFolder = quote("E:\Delphi\Projects\one");
$TargetFolder = quote("X:\Backup\one");
run "cmd /c xcopy $SourceFolder $TargetFolder /kreisch /EXCLUDE:$XcopyExcListFile";
//delete [recycle=1], [confirm], [itemlist]
delete , 0, $XcopyExcListFile;
//////// Or with copy log and errorlevel:
//$cmd = "cmd /c xcopy $SourceFolder $TargetFolder /kreischY ";
//$cmd = $cmd . "/EXCLUDE:$XcopyExcListFile >C:\Temp\er ";
//$cmd = $cmd . "&& Echo. >> C:\Temp\er";
//$cmd = $cmd . "&& Echo ERRORLEVEL = %errorlevel% >> C:\Temp\er";
//run $cmd;
//text "XCopy finished <crlf>" . readfile("C:\Temp\er");
//delete , 0, "C:\Temp\er";
//delete , 0, $XcopyExcListFile;
You can e.g. create an button to execute this script.
If you need more comfort like folder-selecting-dialog or like this... just ask and someone will help you.
.
XYplorer Beta Club