Page 1 of 1

Ignore on copy

Posted: 22 Jul 2010 20:00
by roy.lambert
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

Re: Ignore on copy

Posted: 22 Jul 2010 20:04
by nas8e9
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
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?

Re: Ignore on copy

Posted: 22 Jul 2010 20:37
by zer0
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 :)

Re: Ignore on copy

Posted: 22 Jul 2010 21:56
by Stefan
Hi roy.
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
You can simple use xcopy:

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;
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.

.